diff --git a/lib/server/dbHelpers/chapterTransformer.ts b/lib/server/dbHelpers/chapterTransformer.ts index 2b8e88c..722e89a 100644 --- a/lib/server/dbHelpers/chapterTransformer.ts +++ b/lib/server/dbHelpers/chapterTransformer.ts @@ -5,12 +5,13 @@ import { stringifyStream } from "~/lib/functions"; import { IStory } from "~/models/stories"; import { IChapter } from "~/models/stories/chapter"; import getBucket from "../storyHelpers/getBucket"; +import { SingleChapterResult } from "~/lib/client/types/slightlyDifferentStory"; export default async function ( story: Document & IStory, event: H3Event, - cindex?: number, -) { + cindex: number, +): Promise { const finObj: any = story.toObject(); const cloned: any & { chapters: IChapter[] } = { ...finObj }; delete finObj.chapters; @@ -30,5 +31,6 @@ export default async function ( .replace(/

<\/p>/gm, ""), }; finObj.totalChapters = story.chapters.length; + finObj.chapterNames = story.chapters.map((a) => a.title); return finObj; }