44 lines
742 B
TypeScript
44 lines
742 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;
|
|
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",
|
|
);
|