next/lib/server/storyHelpers/formChapterTransform.ts
2023-10-02 15:44:55 -04:00

23 lines
659 B
TypeScript

import san from "sanitize-html";
import { FormChapter } from "~/lib/client/types/FormStory";
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;
}