widget panel Create and get operations completed

This commit is contained in:
2025-03-26 18:10:01 +05:30
parent effb148159
commit 15688d17c5
13 changed files with 310 additions and 78 deletions

View File

@@ -1,3 +1,39 @@
// import mongoose, { Schema, Document, model } from "mongoose";
// import MainModel from "../../../connect/mongoose.ts";
// export interface Zone extends Document {
// zoneName: string;
// // zoneUUID: string;
// zonePoints: [];
// centerPoints: [];
// isArchive: boolean;
// createdBy: string;
// sceneID: string;
// // createdBy: mongoose.Types.ObjectId;
// // sceneID: mongoose.Types.ObjectId;
// layer: number;
// }
// const zoneSchema: Schema = new Schema(
// {
// zoneName: { type: String },
// // zoneUUID: { type: String },
// createdBy: { type: String },
// sceneID: { type: String },
// layer: { type: Number },
// centerPoints: { type: Array },
// zonePoints: { type: Array },
// isArchive: { type: Boolean, default: false },
// // createdBy: { type: mongoose.Schema.Types.ObjectId, ref: "User" },
// // sceneID: { type: mongoose.Schema.Types.ObjectId, ref: "Scene" },
// },
// { timestamps: true }
// );
// const dataModel = (db: any) => {
// return MainModel(db, "Zones", zoneSchema, "Zones");
// };
// export default dataModel;
import mongoose, { Schema, Document, model } from "mongoose";
import MainModel from "../../../connect/mongoose.ts";
@@ -5,10 +41,13 @@ export interface Zone extends Document {
zoneName: string;
// zoneUUID: string;
zonePoints: [];
centerPoints: [];
viewPortCenter: [];
viewPortposition: [];
isArchive: boolean;
createdBy: string;
sceneID: string;
panelOrder: string[];
lockedPanel: string[];
// createdBy: mongoose.Types.ObjectId;
// sceneID: mongoose.Types.ObjectId;
layer: number;
@@ -23,6 +62,17 @@ const zoneSchema: Schema = new Schema(
centerPoints: { type: Array },
zonePoints: { type: Array },
isArchive: { type: Boolean, default: false },
panelOrder: {
type: [String],
enum: ["left", "right", "up", "down"],
},
viewPortCenter: { type: Array, required: true },
viewPortposition: { type: Array, required: true },
lockedPanel: {
type: [String],
default: [],
enum: ["left", "right", "up", "down"],
},
// createdBy: { type: mongoose.Schema.Types.ObjectId, ref: "User" },
// sceneID: { type: mongoose.Schema.Types.ObjectId, ref: "Scene" },
},
@@ -30,6 +80,6 @@ const zoneSchema: Schema = new Schema(
);
const dataModel = (db: any) => {
return MainModel(db, "Zones", zoneSchema, "Zones");
return MainModel(db, "zones", zoneSchema, "zones");
};
export default dataModel;

View File

@@ -2,37 +2,17 @@ import mongoose, { Schema, Document, model } from "mongoose";
import MainModel from "../../connect/mongoose.ts";
export interface Panel extends Document {
panelOriginalOrder: string[];
panelOrder: [
{
panelName: string;
isArchive: boolean;
}
];
panelSide: string[];
lockedPanel: string[];
sceneID: string;
zoneID: mongoose.Types.ObjectId;
panelName: string;
widgets: [mongoose.Types.ObjectId];
isArchive: boolean;
createdBy: string;
// createdBy: mongoose.Types.ObjectId;
}
const panelSchema: Schema = new Schema(
{
panelOriginalOrder: {
type: [String],
enum: ["left", "right", "up", "down"],
},
panelOrder: [
{ panelName: String, isArchive: { type: Boolean, default: false } },
],
panelSide: { type: [String], enum: ["left", "right", "up", "down"] },
lockedPanel: { type: [String], enum: ["left", "right", "up", "down"] },
sceneID: { type: String },
zoneID: { type: mongoose.Schema.Types.ObjectId, ref: "Zone" },
panelName: { type: String },
widgets: [{ type: mongoose.Schema.Types.ObjectId, ref: "Widget" }],
isArchive: { type: Boolean, default: false },
createdBy: { type: String },
// createdBy: { type: mongoose.Schema.Types.ObjectId, ref: "User" },
},
{ timestamps: true }
);

View File

@@ -0,0 +1,18 @@
import mongoose, { Schema, Document, model } from "mongoose";
import MainModel from "../../connect/mongoose.ts";
export interface Template extends Document {
// templateName:;
isArchive: boolean;
}
const templateSchema: Schema = new Schema(
{
isArchive: { type: Boolean, default: false },
},
{ timestamps: true }
);
const dataModel = (db: any) => {
return MainModel(db, "template", templateSchema, "template");
};
export default dataModel;

View File

@@ -3,24 +3,32 @@ import MainModel from "../../connect/mongoose.ts";
export interface widget extends Document {
widgetName: string;
widgetType: string;
panelorderID: mongoose.Types.ObjectId;
widgetside: string;
widgetID: string;
widgetOrder: string;
elementType: string;
elementColor: string;
fontFamily: string;
fontStyle: string;
fontWeight: string;
isArchive: boolean;
// zoneID: string;
zoneID: mongoose.Types.ObjectId;
sceneID: string;
// sceneID: mongoose.Types.ObjectId;
Data: string[];
panelID: mongoose.Types.ObjectId;
Data: [];
}
const widgetSchema: Schema = new Schema(
{
widgetName: { type: String },
widgetType: { type: String },
widgetside: { type: String },
widgetID: { type: String },
widgetOrder: { type: String },
elementType: { type: String },
elementColor: { type: String },
fontFamily: { type: String },
fontStyle: { type: String },
Data: { type: Array },
fontWeight: { type: String },
isArchive: { type: Boolean, default: false },
panelorderID: { type: mongoose.Schema.Types.ObjectId, ref: "Panel" },
zoneID: { type: mongoose.Schema.Types.ObjectId, ref: "Zone" },
sceneID: { type: String },
panelID: { type: mongoose.Schema.Types.ObjectId, ref: "Panel" },
},
{ timestamps: true }
);