From 997962e391e07847e99d9496fa520ca20d6f9a2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Mon, 25 Sep 2023 19:50:50 -0400 Subject: [PATCH] feat(db/models): create model to store sidebar items in database --- models/sidebarEntry.ts | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 models/sidebarEntry.ts diff --git a/models/sidebarEntry.ts b/models/sidebarEntry.ts new file mode 100644 index 0000000..92d70b9 --- /dev/null +++ b/models/sidebarEntry.ts @@ -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({ + color: { + type: String, + enum: Object.values(Color) + }, + url: { + type: String + }, + linkTitle: { + type: String + }, + index: { + type: Number + } +}) + +export const SidebarItem: Model = /* mongoose.models.SidebarItem || */ mongoose.model("SidebarItem", SISchema, "sidebar")