panel widget point service and model API completed
This commit is contained in:
62
src/shared/model/builder/assets/asset-Model.ts
Normal file
62
src/shared/model/builder/assets/asset-Model.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import mongoose, { Document, Schema } from "mongoose";
|
||||
import MainModel from "../../../connect/mongoose.ts";
|
||||
|
||||
// Interface for TypeScript with PascalCase
|
||||
export interface assetData extends Document {
|
||||
modeluuid: string;
|
||||
modelfileID: string;
|
||||
modelname: string;
|
||||
isLocked: boolean;
|
||||
isVisible: boolean;
|
||||
position: [];
|
||||
rotation: {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
};
|
||||
points: [
|
||||
{
|
||||
uuid: string;
|
||||
position: [];
|
||||
rotation: [];
|
||||
actions: [mongoose.Types.ObjectId];
|
||||
triggers: [mongoose.Types.ObjectId];
|
||||
// connections:{
|
||||
// source:{
|
||||
// pathuuid:string,pointuuid:string
|
||||
// },
|
||||
// target:[]
|
||||
// }
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
// Define the Mongoose Schema
|
||||
const assetDataSchema: Schema = new Schema({
|
||||
modeluuid: { type: String },
|
||||
modelfileID: { type: String },
|
||||
modelname: { type: String },
|
||||
position: { type: Array },
|
||||
points: [
|
||||
{
|
||||
uuid: { type: String },
|
||||
position: { type: Array },
|
||||
rotation: { type: Array },
|
||||
actions: [{ type: mongoose.Schema.Types.ObjectId, ref: "Widget" }],
|
||||
triggers: [{ type: mongoose.Schema.Types.ObjectId, ref: "Widget" }],
|
||||
},
|
||||
],
|
||||
isLocked: { type: Boolean },
|
||||
isVisible: { type: Boolean },
|
||||
rotation: {
|
||||
x: { type: Number, required: true },
|
||||
y: { type: Number, required: true },
|
||||
z: { type: Number, required: true },
|
||||
},
|
||||
});
|
||||
|
||||
// export default floorItemsModel;
|
||||
const assetModel = (db: string) => {
|
||||
return MainModel(db, "Assets", assetDataSchema, "Assets");
|
||||
};
|
||||
export default assetModel;
|
||||
@@ -1,38 +0,0 @@
|
||||
import mongoose, { Document, Schema } from "mongoose";
|
||||
import MainModel from "../../../connect/mongoose.ts";
|
||||
|
||||
// Interface for TypeScript with PascalCase
|
||||
export interface floorItenms extends Document {
|
||||
modeluuid: string;
|
||||
modelfileID: string;
|
||||
modelname: string;
|
||||
isLocked: boolean;
|
||||
isVisible: boolean;
|
||||
position: [];
|
||||
rotation: {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
};
|
||||
}
|
||||
|
||||
// Define the Mongoose Schema
|
||||
const floorItemsSchema: Schema = new Schema({
|
||||
modeluuid: { type: String },
|
||||
modelfileID: { type: String },
|
||||
modelname: { type: String },
|
||||
position: { type: Array },
|
||||
isLocked: { type: Boolean },
|
||||
isVisible: { type: Boolean },
|
||||
rotation: {
|
||||
x: { type: Number, required: true },
|
||||
y: { type: Number, required: true },
|
||||
z: { type: Number, required: true },
|
||||
},
|
||||
});
|
||||
|
||||
// export default floorItemsModel;
|
||||
const floorItemsModel = (db: string) => {
|
||||
return MainModel(db, "floorItems", floorItemsSchema, "floorItems");
|
||||
};
|
||||
export default floorItemsModel;
|
||||
59
src/shared/model/builder/assets/pointSchema.ts
Normal file
59
src/shared/model/builder/assets/pointSchema.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import mongoose, { Document, Schema } from "mongoose";
|
||||
import MainModel from "../../../connect/mongoose.ts";
|
||||
|
||||
// Interface for TypeScript with PascalCase
|
||||
export interface Points extends Document {
|
||||
modelfileID: string;
|
||||
points: {
|
||||
uuid: string;
|
||||
position: number[];
|
||||
rotation: number[];
|
||||
actions: string[];
|
||||
triggers: string[];
|
||||
}[];
|
||||
}
|
||||
const defaultPoints = [
|
||||
{
|
||||
uuid: "",
|
||||
position: [0, 1.25, 3.3],
|
||||
rotation: [0, 0, 0],
|
||||
actions: [],
|
||||
triggers: [],
|
||||
},
|
||||
{
|
||||
uuid: "",
|
||||
position: [0, 1.25, 3.3],
|
||||
rotation: [0, 0, 0],
|
||||
actions: [],
|
||||
triggers: [],
|
||||
},
|
||||
{
|
||||
uuid: "",
|
||||
position: [0, 1.25, 3.3],
|
||||
rotation: [0, 0, 0],
|
||||
actions: [],
|
||||
triggers: [],
|
||||
},
|
||||
];
|
||||
// Define the Mongoose Schema
|
||||
const pointSchema: Schema = new Schema({
|
||||
modelfileID: { type: String, required: true },
|
||||
points: {
|
||||
type: [
|
||||
{
|
||||
uuid: { type: String },
|
||||
position: { type: [Number], default: [0, 1.25, 3.3] },
|
||||
rotation: { type: [Number], default: [0, 0, 0] },
|
||||
actions: { type: [String], default: [] },
|
||||
triggers: { type: [String], default: [] },
|
||||
},
|
||||
],
|
||||
default: defaultPoints,
|
||||
},
|
||||
});
|
||||
|
||||
const pointModel = (db: string) => {
|
||||
return MainModel(db, "Points", pointSchema, "Points");
|
||||
};
|
||||
|
||||
export default pointModel;
|
||||
@@ -39,7 +39,7 @@ import MainModel from "../../../connect/mongoose.ts";
|
||||
|
||||
export interface Zone extends Document {
|
||||
zoneName: string;
|
||||
// zoneUUID: string;
|
||||
zoneId: string;
|
||||
zonePoints: [];
|
||||
viewPortCenter: [];
|
||||
viewPortposition: [];
|
||||
@@ -55,12 +55,11 @@ export interface Zone extends Document {
|
||||
const zoneSchema: Schema = new Schema(
|
||||
{
|
||||
zoneName: { type: String },
|
||||
// zoneUUID: { type: String },
|
||||
zoneId: { type: String },
|
||||
createdBy: { type: String },
|
||||
sceneID: { type: String },
|
||||
layer: { type: Number },
|
||||
centerPoints: { type: Array },
|
||||
zonePoints: { type: Array },
|
||||
points: { type: Array },
|
||||
isArchive: { type: Boolean, default: false },
|
||||
panelOrder: {
|
||||
type: [String],
|
||||
@@ -79,7 +78,7 @@ const zoneSchema: Schema = new Schema(
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
const dataModel = (db: any) => {
|
||||
const zoneModel = (db: any) => {
|
||||
return MainModel(db, "zones", zoneSchema, "zones");
|
||||
};
|
||||
export default dataModel;
|
||||
export default zoneModel;
|
||||
|
||||
39
src/shared/model/simulation/actionmodel.ts
Normal file
39
src/shared/model/simulation/actionmodel.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import mongoose, { Schema, Document, model } from "mongoose";
|
||||
import MainModel from "../../connect/mongoose.ts";
|
||||
|
||||
export interface Event extends Document {
|
||||
pointsUUID: string;
|
||||
actionUUID: string;
|
||||
isArchive: string;
|
||||
sceneID: string;
|
||||
eventData: {
|
||||
uuid: string;
|
||||
type: string;
|
||||
material: string;
|
||||
delay: number;
|
||||
spawn_Interval: number;
|
||||
};
|
||||
}
|
||||
const eventSchema: Schema = new Schema(
|
||||
{
|
||||
pointsUUID: { type: String },
|
||||
isArchive: { type: Boolean, default: false },
|
||||
actionUUID: { type: String },
|
||||
sceneID: { type: String },
|
||||
eventData: [
|
||||
{
|
||||
uuid: { type: String },
|
||||
type: { type: String },
|
||||
material: { type: String },
|
||||
delay: { type: Number },
|
||||
spawn_Interval: { type: Number },
|
||||
},
|
||||
],
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
const actionModel = (db: any) => {
|
||||
return MainModel(db, "Events", eventSchema, "Events");
|
||||
};
|
||||
export default actionModel;
|
||||
@@ -0,0 +1,39 @@
|
||||
import mongoose, { Schema, Document, model } from "mongoose";
|
||||
import MainModel from "../../connect/mongoose.ts";
|
||||
|
||||
export interface Trigger extends Document {
|
||||
pointsUUID: string;
|
||||
actionUUID: string;
|
||||
isArchive: string;
|
||||
sceneID: string;
|
||||
triggerData: {
|
||||
uuid: string;
|
||||
type: string;
|
||||
// material: string;
|
||||
// delay: number;
|
||||
// spawn_Interval: number;
|
||||
};
|
||||
}
|
||||
const triggerSchema: Schema = new Schema(
|
||||
{
|
||||
pointsUUID: { type: String },
|
||||
isArchive: { type: Boolean, default: false },
|
||||
actionUUID: { type: String },
|
||||
sceneID: { type: String },
|
||||
triggerData: [
|
||||
{
|
||||
uuid: { type: String },
|
||||
type: { type: String },
|
||||
// material: { type: String },
|
||||
// delay: { type: Number },
|
||||
// spawn_Interval: { type: Number },
|
||||
},
|
||||
],
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
const triggerModel = (db: any) => {
|
||||
return MainModel(db, "Triggers", triggerSchema, "Triggers");
|
||||
};
|
||||
export default triggerModel;
|
||||
|
||||
@@ -2,14 +2,16 @@ import mongoose, { Schema, Document, model } from "mongoose";
|
||||
import MainModel from "../../connect/mongoose.ts";
|
||||
|
||||
export interface Panel extends Document {
|
||||
zoneID: mongoose.Types.ObjectId;
|
||||
// zoneID: mongoose.Types.ObjectId;
|
||||
zoneId: string;
|
||||
panelName: string;
|
||||
widgets: [mongoose.Types.ObjectId];
|
||||
isArchive: boolean;
|
||||
}
|
||||
const panelSchema: Schema = new Schema(
|
||||
{
|
||||
zoneID: { type: mongoose.Schema.Types.ObjectId, ref: "Zone" },
|
||||
// zoneID: { type: mongoose.Schema.Types.ObjectId, ref: "Zone" },
|
||||
zoneId: { type: String },
|
||||
panelName: { type: String },
|
||||
widgets: [{ type: mongoose.Schema.Types.ObjectId, ref: "Widget" }],
|
||||
isArchive: { type: Boolean, default: false },
|
||||
@@ -17,7 +19,7 @@ const panelSchema: Schema = new Schema(
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
const dataModel = (db: any) => {
|
||||
const panelModel = (db: any) => {
|
||||
return MainModel(db, "Panel", panelSchema, "Panel");
|
||||
};
|
||||
export default dataModel;
|
||||
export default panelModel;
|
||||
|
||||
@@ -2,17 +2,18 @@ import mongoose, { Schema, Document, model } from "mongoose";
|
||||
import MainModel from "../../connect/mongoose.ts";
|
||||
|
||||
export interface Template extends Document {
|
||||
// templateName:;
|
||||
templateName: string;
|
||||
isArchive: boolean;
|
||||
}
|
||||
const templateSchema: Schema = new Schema(
|
||||
{
|
||||
templateName: { type: String },
|
||||
isArchive: { type: Boolean, default: false },
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
const dataModel = (db: any) => {
|
||||
return MainModel(db, "template", templateSchema, "template");
|
||||
const templateModel = (db: any) => {
|
||||
return MainModel(db, "Template", templateSchema, "Template");
|
||||
};
|
||||
export default dataModel;
|
||||
export default templateModel;
|
||||
|
||||
@@ -13,7 +13,10 @@ export interface widget extends Document {
|
||||
fontWeight: string;
|
||||
isArchive: boolean;
|
||||
panelID: mongoose.Types.ObjectId;
|
||||
Data: [];
|
||||
Data: {
|
||||
measurement: Record<string, any>;
|
||||
duration: string;
|
||||
};
|
||||
}
|
||||
const widgetSchema: Schema = new Schema(
|
||||
{
|
||||
@@ -25,7 +28,13 @@ const widgetSchema: Schema = new Schema(
|
||||
elementColor: { type: String },
|
||||
fontFamily: { type: String },
|
||||
fontStyle: { type: String },
|
||||
Data: { type: Array },
|
||||
Data: {
|
||||
measurements: {
|
||||
type: Object,
|
||||
default: {},
|
||||
},
|
||||
duration: { type: String, default: "1hr" },
|
||||
},
|
||||
fontWeight: { type: String },
|
||||
isArchive: { type: Boolean, default: false },
|
||||
panelID: { type: mongoose.Schema.Types.ObjectId, ref: "Panel" },
|
||||
@@ -33,7 +42,7 @@ const widgetSchema: Schema = new Schema(
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
const dataModel = (db: any) => {
|
||||
const widgetModel = (db: any) => {
|
||||
return MainModel(db, "Widget", widgetSchema, "Widget");
|
||||
};
|
||||
export default dataModel;
|
||||
export default widgetModel;
|
||||
|
||||
Reference in New Issue
Block a user