☙◦ The Tablet ❀ GamerGirlandCo ◦❧
c8bdcc0ec3
`bodyHandler` takes a request body and returns the chapter content as a string `formChapterTransform` serializes a chapter-like object supplied in a request body to an actual proper chapter object `getBucket` retrieves the story content gridfs bucket `replaceGridFS` either creates or updates (deletes + reuploads) a gridfs file
23 lines
640 B
TypeScript
23 lines
640 B
TypeScript
import san from "sanitize-html";
|
|
import { FormChapter } from "~/lib/client/types/form/story";
|
|
import { countWords } from "~/lib/functions";
|
|
import { IChapter } from "~/models/stories/chapter";
|
|
import { sanitizeConf } from "../constants";
|
|
import bodyHandler from "./bodyHandler";
|
|
|
|
export default function (c: FormChapter): IChapter {
|
|
let t: IChapter = {
|
|
title: c.chapterTitle,
|
|
summary: san(c.summary, sanitizeConf),
|
|
notes: san(c.notes, sanitizeConf),
|
|
bands: c.bands,
|
|
characters: c.characters,
|
|
relationships: c.relationships,
|
|
nsfw: c.nsfw,
|
|
genre: c.genre,
|
|
loggedInOnly: c.loggedInOnly,
|
|
hidden: c.hidden,
|
|
};
|
|
return t;
|
|
}
|