feat(db/models): create model to store sidebar items in database
This commit is contained in:
parent
2ea40ebb07
commit
997962e391
38
models/sidebarEntry.ts
Normal file
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")
|
Loading…
Reference in New Issue
Block a user