Schema Model - new Version Added
This commit is contained in:
46
src/shared/V1Models/Vizualization/floatWidget.ts
Normal file
46
src/shared/V1Models/Vizualization/floatWidget.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { Schema, Document, model } from "mongoose";
|
||||
import MainModel from "../../connect/mongoose.ts";
|
||||
import { Zone } from "../Builder/zoneModel.ts";
|
||||
export interface FloatingWidget extends Document {
|
||||
className: string;
|
||||
iconName: string;
|
||||
header: string;
|
||||
floatWidgetID: string;
|
||||
position: {};
|
||||
per: string;
|
||||
value: string;
|
||||
isArchive: boolean;
|
||||
zoneId: Zone["_id"];
|
||||
Data: {
|
||||
measurements: {};
|
||||
duration: string;
|
||||
};
|
||||
}
|
||||
const floatingWidgetSchema: Schema = new Schema(
|
||||
{
|
||||
className: { type: String },
|
||||
iconName: { type: String },
|
||||
header: { type: String },
|
||||
floatWidgetID: { type: String },
|
||||
position: { type: Object },
|
||||
per: { type: String },
|
||||
value: { type: String },
|
||||
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 floatWidgetModel = (db: any) => {
|
||||
return MainModel(
|
||||
db,
|
||||
"FloatingWidget",
|
||||
floatingWidgetSchema,
|
||||
"FloatingWidget"
|
||||
);
|
||||
};
|
||||
export default floatWidgetModel;
|
||||
Reference in New Issue
Block a user