refactor(server/utils): make the chapter index parameter in the chapterTransformer function mandatory
This commit is contained in:
		
							parent
							
								
									e69965f6ec
								
							
						
					
					
						commit
						d5de2499ab
					
				| @ -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<number, {}, IStory> & IStory, | ||||
| 	event: H3Event<EventHandlerRequest>, | ||||
| 	cindex?: number, | ||||
| ) { | ||||
| 	cindex: number, | ||||
| ): Promise<SingleChapterResult> { | ||||
| 	const finObj: any = story.toObject(); | ||||
| 	const cloned: any & { chapters: IChapter[] } = { ...finObj }; | ||||
| 	delete finObj.chapters; | ||||
| @ -30,5 +31,6 @@ export default async function ( | ||||
| 			.replace(/<p><br\s\/><b\s\/><\/p>/gm, ""), | ||||
| 	}; | ||||
| 	finObj.totalChapters = story.chapters.length; | ||||
| 	finObj.chapterNames = story.chapters.map((a) => a.title); | ||||
| 	return finObj; | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user