next/lib/server/storyHelpers/formChapterTransform.ts

21 lines
547 B
TypeScript
Raw Permalink Normal View History

import san from "sanitize-html";
import { FormChapter } from "@client/types/form/story";
import { IChapter } from "@models/stories/chapter";
import { sanitizeConf } from "../constants";
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;
}