Schema Model - new Version Added

This commit is contained in:
2025-05-17 11:15:53 +05:30
parent 5566b74633
commit 1c55013c2b
18 changed files with 833 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
import { Schema, Document, model } from "mongoose";
import MainModel from "../../connect/mongoose.ts";
import { Zone } from "../Builder/zoneModel.ts";
export interface Widget3d extends Document {
type: string;
widgetID: string;
widgetName: string;
position: [];
rotation: [];
isArchive: boolean;
zoneId: Zone["_id"];
Data: {
measurements: {};
duration: string;
};
}
const Widget3dSchema: Schema = new Schema(
{
type: { type: String },
widgetID: { type: String },
widgetName: { type: String, default: "Widget3D" },
position: { type: Array },
rotation: { type: Array },
zoneId: { type: Schema.Types.ObjectId, ref: "Zone" },
Data: {
measurements: { type: Object, default: {} },
duration: { type: String, default: "1h" },
},
isArchive: { type: Boolean, default: false },
},
{ timestamps: true }
);
const widget3dModel = (db: any) => {
return MainModel(db, "3dWidget", Widget3dSchema, "3dWidget");
};
export default widget3dModel;