66 lines
1015 B
TypeScript
66 lines
1015 B
TypeScript
|
import mongoose, {Schema, PopulatedDoc, Document, Model} from "mongoose";
|
||
|
import { IBand } from "../band";
|
||
|
export interface IChapter {
|
||
|
title: string;
|
||
|
summary: string;
|
||
|
id?: number;
|
||
|
// index: number;
|
||
|
words?: number;
|
||
|
notes: string;
|
||
|
genre: string[];
|
||
|
bands: PopulatedDoc<IBand & Document>[];
|
||
|
characters: string[];
|
||
|
relationships: string[][];
|
||
|
nsfw: boolean;
|
||
|
loggedInOnly: boolean;
|
||
|
hidden: boolean;
|
||
|
posted: Date;
|
||
|
reviews: number
|
||
|
}
|
||
|
|
||
|
export const Chapter = new mongoose.Schema<IChapter>({
|
||
|
title: {
|
||
|
type: String,
|
||
|
default: ""
|
||
|
},
|
||
|
id: {
|
||
|
type: Number
|
||
|
},
|
||
|
summary: {
|
||
|
type: String
|
||
|
},
|
||
|
words: {
|
||
|
type: Number
|
||
|
},
|
||
|
notes: {
|
||
|
type: String
|
||
|
},
|
||
|
genre: [{
|
||
|
type: String
|
||
|
}],
|
||
|
bands: [{
|
||
|
type: Number,
|
||
|
ref: "Band"
|
||
|
}],
|
||
|
reviews: {
|
||
|
type: Number
|
||
|
},
|
||
|
characters: [{ type: String }],
|
||
|
relationships: [{ type: String }],
|
||
|
nsfw: {
|
||
|
type: Boolean
|
||
|
},
|
||
|
loggedInOnly: {
|
||
|
type: Boolean,
|
||
|
default: true
|
||
|
},
|
||
|
hidden: {
|
||
|
type: Boolean,
|
||
|
default: false
|
||
|
},
|
||
|
posted: {
|
||
|
type: Date,
|
||
|
default: new Date()
|
||
|
}
|
||
|
})
|