feat(db/models): create model to store sidebar items in database

This commit is contained in:
parent 2ea40ebb07
commit 997962e391
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

38
models/sidebarEntry.ts Normal file

@ -0,0 +1,38 @@
import mongoose, {Schema, PopulatedDoc, Document, Model} from "mongoose";
export enum Color {
"orange" = "orange",
"yellow" = "yellow",
"green" = "green",
"turquoise" = "turquoise",
"cyan" = "cyan",
"blue" = "blue",
"purple" = "purple",
"red" = "red",
"pink" = "pink"
}
export interface ISidebarItem {
color: Color
url: string
linkTitle: string
index: number;
}
const SISchema = new mongoose.Schema<ISidebarItem>({
color: {
type: String,
enum: Object.values(Color)
},
url: {
type: String
},
linkTitle: {
type: String
},
index: {
type: Number
}
})
export const SidebarItem: Model<ISidebarItem> = /* mongoose.models.SidebarItem || */ mongoose.model("SidebarItem", SISchema, "sidebar")