From 04e769ea9017d117a416154dd545fb2a49760796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Mon, 2 Oct 2023 15:52:23 -0400 Subject: [PATCH] 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` --- lib/client/types/FormStory.ts | 96 +++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 45 deletions(-) diff --git a/lib/client/types/FormStory.ts b/lib/client/types/FormStory.ts index 641d52b..81c24b5 100644 --- a/lib/client/types/FormStory.ts +++ b/lib/client/types/FormStory.ts @@ -1,45 +1,51 @@ -export interface FormChapter { - chapterTitle: string; - index: number; - summary: string; - notes: string; - genre: string[]; - bands: number[]; - characters: string[]; - relationships: string[][]; - nsfw: boolean; - loggedInOnly: boolean; - hidden: boolean; - content: string; - fileName: string; -} - -export interface FormStory { - title: string; - chapters: FormChapter[]; - ficmas?: number | null; - challenge?: number | null; -} - -export const defaultChapter: FormChapter = { - chapterTitle: "", - index: 1, - summary: "", - notes: "", - genre: [], - bands: [], - characters: [], - relationships: [], - nsfw: false, - loggedInOnly: true, - hidden: false, - content: "", - fileName: "" -} - -export const defaultStory: FormStory = { - title: "", - chapters: [], - ficmas: null, - challenge: null, -} \ No newline at end of file +import { V4Options, v4 } from "uuid"; + +export interface FormChapter { + id?: number; + chapterTitle: string; + index: number; + summary: string; + notes: string; + genre: string[]; + bands: number[]; + characters: string[]; + relationships: string[][]; + nsfw: boolean; + loggedInOnly: boolean; + hidden: boolean; + content: string; + file?: string; + uuidKey: string; +} + +export interface FormStory { + title: string; + chapters: FormChapter[]; + ficmas?: number | null; + challenge?: number | null; + completed: boolean; +} + +export const defaultChapter: FormChapter = { + chapterTitle: "", + index: 1, + summary: "", + notes: "", + genre: [], + bands: [], + characters: [], + relationships: [], + nsfw: false, + loggedInOnly: true, + hidden: false, + content: "", + uuidKey: v4(), +}; + +export const defaultStory: FormStory = { + title: "", + chapters: [], + ficmas: null, + challenge: null, + completed: false, +};