next/models/sidebarEntry.ts

39 lines
710 B
TypeScript
Raw Normal View History

2023-12-29 20:11:07 -05:00
import mongoose, { Model } from "mongoose";
export enum Color {
"orange" = "orange",
"yellow" = "yellow",
"green" = "green",
"turquoise" = "turquoise",
"cyan" = "cyan",
"blue" = "blue",
"purple" = "purple",
"red" = "red",
2023-10-03 01:22:43 -04:00
"pink" = "pink",
}
export interface ISidebarItem {
color: Color | string;
2023-10-03 01:22:43 -04:00
url: string;
linkTitle: string;
index: number;
}
const SISchema = new mongoose.Schema<ISidebarItem>({
color: {
type: String,
},
url: {
2023-10-03 01:22:43 -04:00
type: String,
},
linkTitle: {
2023-10-03 01:22:43 -04:00
type: String,
},
index: {
2023-10-03 01:22:43 -04:00
type: Number,
},
});
2023-10-03 01:22:43 -04:00
export const SidebarItem: Model<ISidebarItem> =
2023-12-29 20:11:07 -05:00
mongoose.models.SidebarItem || /* mongoose.models.SidebarItem || */ mongoose.model("SidebarItem", SISchema, "sidebar");