32 lines
947 B
TypeScript
32 lines
947 B
TypeScript
import mongoose, { Schema, Document, model } from "mongoose";
|
|
import MainModel from "../../connect/mongoose.ts";
|
|
|
|
export interface widget extends Document {
|
|
widgetName: string;
|
|
widgetType: string;
|
|
panelorderID: mongoose.Types.ObjectId;
|
|
isArchive: boolean;
|
|
// zoneID: string;
|
|
zoneID: mongoose.Types.ObjectId;
|
|
sceneID: string;
|
|
// sceneID: mongoose.Types.ObjectId;
|
|
Data: string[];
|
|
}
|
|
const widgetSchema: Schema = new Schema(
|
|
{
|
|
widgetName: { type: String },
|
|
widgetType: { type: String },
|
|
Data: { type: Array },
|
|
isArchive: { type: Boolean, default: false },
|
|
panelorderID: { type: mongoose.Schema.Types.ObjectId, ref: "Panel" },
|
|
zoneID: { type: mongoose.Schema.Types.ObjectId, ref: "Zone" },
|
|
sceneID: { type: String },
|
|
},
|
|
{ timestamps: true }
|
|
);
|
|
|
|
const dataModel = (db: any) => {
|
|
return MainModel(db, "Widget", widgetSchema, "Widget");
|
|
};
|
|
export default dataModel;
|