Full Visualization Page API completed

This commit is contained in:
2025-03-31 18:30:14 +05:30
parent 10ece17128
commit 9456cbcbbe
18 changed files with 610 additions and 237 deletions

View File

@@ -35,7 +35,7 @@ export interface assetData extends Document {
}[];
assetPosition: number[];
assetRotation: number[];
speed: number;
speed: number | string;
}
// Define the Mongoose Schema
@@ -68,7 +68,7 @@ const assetDataSchema: Schema = new Schema({
],
assetPosition: { type: [Number] },
assetRotation: { type: [Number] },
speed: { type: Number },
speed: { type: Schema.Types.Mixed },
isLocked: { type: Boolean },
isVisible: { type: Boolean },
// rotation: {

View File

@@ -1,18 +1,23 @@
import mongoose, { Document, Schema } from 'mongoose';
import MainModel from '../../connect/mongoose.ts';
import mongoose, { Document, Schema } from "mongoose";
import MainModel from "../../connect/mongoose.ts";
// Interface for TypeScript with PascalCase
export interface environment extends Document {
userId: string;
roofVisibility:boolean
wallVisibility:boolean
roofVisibility: boolean;
wallVisibility: boolean;
renderDistance: number;
shadowVisibility: boolean;
limitDistance: boolean;
}
// Define the Mongoose Schema
const environmentSchema: Schema = new Schema({
userId: { type: String, unique: true },
roofVisibility: { type: Boolean ,default:false},
wallVisibility: { type: Boolean ,default:false},
shadowVisibility: { type: Boolean ,default:false},
roofVisibility: { type: Boolean, default: false },
wallVisibility: { type: Boolean, default: false },
shadowVisibility: { type: Boolean, default: false },
renderDistance: { type: Number, default: false },
limitDistance: { type: Boolean, default: true },
});
// Model for MongoDB collection
@@ -33,7 +38,7 @@ const environmentSchema: Schema = new Schema({
// }
// export default environmentModel;
const environmentModel = (db:string) => {
return MainModel(db, "environments", environmentSchema, "environments")
const environmentModel = (db: string) => {
return MainModel(db, "environments", environmentSchema, "environments");
};
export default environmentModel;
export default environmentModel;

View File

@@ -1,13 +1,10 @@
import mongoose, { Schema, Document, model } from "mongoose";
import MainModel from "../../connect/mongoose.ts";
export interface floatingWidget extends Document {
className: string;
header: string;
floatWidgetID: string;
position: {};
per: string;
value: string;
export interface Widget3d extends Document {
widgetName: string;
widgetID: string;
position: [];
isArchive: boolean;
zoneId: string;
Data: {
@@ -15,14 +12,11 @@ export interface floatingWidget extends Document {
duration: string;
};
}
const floatingWidgetSchema: Schema = new Schema(
const Widget3dSchema: Schema = new Schema(
{
className: { type: String },
header: { type: String },
floatWidgetID: { type: String },
position: { type: Object },
per: { type: String },
value: { type: String },
widgetName: { type: String },
widgetID: { type: String },
position: { type: Array },
zoneId: { type: String },
Data: {
measurements: { type: Object, default: {} },
@@ -33,12 +27,7 @@ const floatingWidgetSchema: Schema = new Schema(
{ timestamps: true }
);
const floatWidgetModel = (db: any) => {
return MainModel(
db,
"FloatingWidget",
floatingWidgetSchema,
"FloatingWidget"
);
const widget3dModel = (db: any) => {
return MainModel(db, "3dWidget", Widget3dSchema, "3dWidget");
};
export default floatWidgetModel;
export default widget3dModel;

View File

@@ -0,0 +1,44 @@
import mongoose, { Schema, Document, model } from "mongoose";
import MainModel from "../../connect/mongoose.ts";
export interface floatingWidget extends Document {
className: string;
header: string;
floatWidgetID: string;
position: {};
per: string;
value: string;
isArchive: boolean;
zoneId: string;
Data: {
measurements: {};
duration: string;
};
}
const floatingWidgetSchema: Schema = new Schema(
{
className: { type: String },
header: { type: String },
floatWidgetID: { type: String },
position: { type: Object },
per: { type: String },
value: { type: String },
zoneId: { type: String },
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;

View File

@@ -7,6 +7,8 @@ export interface Template extends Document {
snapshot: string;
panelOrder: [];
widgets: [];
floatWidgets: [];
Widgets3D: [];
isArchive: boolean;
}
const templateSchema: Schema = new Schema(
@@ -16,6 +18,8 @@ const templateSchema: Schema = new Schema(
snapshot: { type: String },
panelOrder: { type: Array },
widgets: { type: Array },
floatWidgets: { type: Array },
Widgets3D: { type: Array },
isArchive: { type: Boolean, default: false },
},
{ timestamps: true }

View File

@@ -20,7 +20,7 @@ export interface widget extends Document {
}
const widgetSchema: Schema = new Schema(
{
widgetName: { type: String },
widgetName: { type: String, default: "Widget" },
widgetside: { type: String },
widgetID: { type: String },
widgetOrder: { type: String },