next/models/sidebarEntry.ts

44 lines
753 B
TypeScript

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 | string;
url: string;
linkTitle: string;
index: number;
}
const SISchema = new mongoose.Schema<ISidebarItem>({
color: {
type: String,
},
url: {
type: String,
},
linkTitle: {
type: String,
},
index: {
type: Number,
},
});
export const SidebarItem: Model<ISidebarItem> =
mongoose.models.SidebarItem ||
/* mongoose.models.SidebarItem || */ mongoose.model(
"SidebarItem",
SISchema,
"sidebar",
);