next/models/sidebarEntry.ts

43 lines
721 B
TypeScript
Raw Normal View History

2023-10-03 01:22:43 -04:00
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",
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> =
/* mongoose.models.SidebarItem || */ mongoose.model(
"SidebarItem",
SISchema,
"sidebar",
);