46 lines
1.2 KiB
TypeScript
46 lines
1.2 KiB
TypeScript
import mongoose, { Schema, Document, model } from "mongoose";
|
|
import MainModel from "../../connect/mongoose.ts";
|
|
|
|
export interface widget extends Document {
|
|
widgetName: string;
|
|
widgetside: string;
|
|
widgetID: string;
|
|
widgetOrder: string;
|
|
elementType: string;
|
|
elementColor: string;
|
|
fontFamily: string;
|
|
fontStyle: string;
|
|
fontWeight: string;
|
|
isArchive: boolean;
|
|
panelID: mongoose.Types.ObjectId;
|
|
Data: {
|
|
measurements: {};
|
|
duration: string;
|
|
};
|
|
}
|
|
const widgetSchema: Schema = new Schema(
|
|
{
|
|
widgetName: { type: String },
|
|
widgetside: { type: String },
|
|
widgetID: { type: String },
|
|
widgetOrder: { type: String },
|
|
elementType: { type: String },
|
|
elementColor: { type: String },
|
|
fontFamily: { type: String },
|
|
fontStyle: { type: String },
|
|
Data: {
|
|
measurements: { type: Object, default: {} },
|
|
duration: { type: String, default: "1h" },
|
|
},
|
|
fontWeight: { type: String },
|
|
isArchive: { type: Boolean, default: false },
|
|
panelID: { type: mongoose.Schema.Types.ObjectId, ref: "Panel" },
|
|
},
|
|
{ timestamps: true }
|
|
);
|
|
|
|
const widgetModel = (db: any) => {
|
|
return MainModel(db, "Widget", widgetSchema, "Widget");
|
|
};
|
|
export default widgetModel;
|