Files
Dwinzo-Backend-V0.0/src/shared/V1Models/Vizualization/floatWidget.ts

47 lines
1.1 KiB
TypeScript

import { Schema, Document } 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;