refactor(client-side): modify form story+chapter types

chapters now have an optional id (for use when editing), and `fileName` has been simplified to `file`
This commit is contained in:
parent d056dac72b
commit 04e769ea90
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -1,4 +1,7 @@
import { V4Options, v4 } from "uuid";
export interface FormChapter { export interface FormChapter {
id?: number;
chapterTitle: string; chapterTitle: string;
index: number; index: number;
summary: string; summary: string;
@ -11,7 +14,8 @@ export interface FormChapter {
loggedInOnly: boolean; loggedInOnly: boolean;
hidden: boolean; hidden: boolean;
content: string; content: string;
fileName: string; file?: string;
uuidKey: string;
} }
export interface FormStory { export interface FormStory {
@ -19,6 +23,7 @@ export interface FormStory {
chapters: FormChapter[]; chapters: FormChapter[];
ficmas?: number | null; ficmas?: number | null;
challenge?: number | null; challenge?: number | null;
completed: boolean;
} }
export const defaultChapter: FormChapter = { export const defaultChapter: FormChapter = {
@ -34,12 +39,13 @@ export const defaultChapter: FormChapter = {
loggedInOnly: true, loggedInOnly: true,
hidden: false, hidden: false,
content: "", content: "",
fileName: "" uuidKey: v4(),
} };
export const defaultStory: FormStory = { export const defaultStory: FormStory = {
title: "", title: "",
chapters: [], chapters: [],
ficmas: null, ficmas: null,
challenge: null, challenge: null,
} completed: false,
};