Visualization Part 2d and floating API Completed. Template Save and Get API completed
This commit is contained in:
@@ -1,44 +1,41 @@
|
||||
import mongoose, { Document, Schema } from "mongoose";
|
||||
import MainModel from "../../../connect/mongoose.ts";
|
||||
|
||||
interface IAction {
|
||||
uuid: string;
|
||||
name: string;
|
||||
type: string;
|
||||
material: string;
|
||||
delay: string;
|
||||
spawnInterval: string;
|
||||
isUsed: boolean;
|
||||
}
|
||||
|
||||
// Interface for TypeScript with PascalCase
|
||||
export interface assetData extends Document {
|
||||
modeluuid: string;
|
||||
modelfileID: string;
|
||||
modelname: string;
|
||||
isLocked: boolean;
|
||||
type: string;
|
||||
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:[]
|
||||
// }
|
||||
}
|
||||
];
|
||||
// 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;
|
||||
};
|
||||
targets: [
|
||||
{
|
||||
pathUUID: string;
|
||||
pointUUID: string;
|
||||
}
|
||||
];
|
||||
}[];
|
||||
}[];
|
||||
assetPosition: number[];
|
||||
assetRotation: number[];
|
||||
speed: number;
|
||||
}
|
||||
|
||||
// Define the Mongoose Schema
|
||||
@@ -46,7 +43,8 @@ const assetDataSchema: Schema = new Schema({
|
||||
modeluuid: { type: String },
|
||||
modelfileID: { type: String },
|
||||
modelname: { type: String },
|
||||
position: { type: Array },
|
||||
type: { type: String },
|
||||
// assetPosition: { type: Array },
|
||||
points: [
|
||||
{
|
||||
uuid: { type: String },
|
||||
@@ -54,15 +52,30 @@ const assetDataSchema: Schema = new Schema({
|
||||
rotation: { type: Array },
|
||||
actions: [{ type: mongoose.Schema.Types.ObjectId, ref: "Actions" }],
|
||||
triggers: [{ type: mongoose.Schema.Types.ObjectId, ref: "Triggers" }],
|
||||
connections: {
|
||||
source: {
|
||||
pathUUID: { type: String },
|
||||
pointUUID: { type: String },
|
||||
},
|
||||
targets: [
|
||||
{
|
||||
pathUUID: { type: String },
|
||||
pointUUID: { type: String },
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
assetPosition: { type: [Number] },
|
||||
assetRotation: { type: [Number] },
|
||||
speed: { type: Number },
|
||||
isLocked: { type: Boolean },
|
||||
isVisible: { type: Boolean },
|
||||
rotation: {
|
||||
x: { type: Number },
|
||||
y: { type: Number },
|
||||
z: { type: Number },
|
||||
},
|
||||
// rotation: {
|
||||
// x: { type: Number },
|
||||
// y: { type: Number },
|
||||
// z: { type: Number },
|
||||
// },
|
||||
});
|
||||
|
||||
// export default floorItemsModel;
|
||||
|
||||
@@ -9,53 +9,81 @@ interface IAction {
|
||||
delay: string;
|
||||
spawnInterval: string;
|
||||
isUsed: boolean;
|
||||
hitCount: number;
|
||||
start: string;
|
||||
end: string;
|
||||
buffer: number;
|
||||
}
|
||||
|
||||
// interface IConnection {
|
||||
// source: { pathUUID: string; pointUUID: string };
|
||||
// targets: string[];
|
||||
// }
|
||||
interface ITriggers {
|
||||
uuid: string;
|
||||
name: string;
|
||||
type: string;
|
||||
isUsed: boolean;
|
||||
bufferTime: number;
|
||||
}
|
||||
|
||||
interface IConnection {
|
||||
source: { pathUUID: string; pointUUID: string };
|
||||
targets: { pathUUID: string; pointUUID: string }[];
|
||||
}
|
||||
|
||||
interface IPoint {
|
||||
uuid: string;
|
||||
position: number[];
|
||||
rotation: number[];
|
||||
actions: IAction[];
|
||||
triggers: string[];
|
||||
// connections: IConnection;
|
||||
triggers: ITriggers[];
|
||||
connections: IConnection;
|
||||
}
|
||||
|
||||
interface IBaseModel extends Document {
|
||||
modelfileID: string;
|
||||
type: "Conveyor" | "Vehicle";
|
||||
points: IPoint[] | IPoint;
|
||||
speed: number;
|
||||
}
|
||||
|
||||
// Base Schema
|
||||
const PointSchema = new Schema<IPoint>({
|
||||
uuid: { type: String, required: true },
|
||||
position: { type: [Number], required: true },
|
||||
rotation: { type: [Number], required: true },
|
||||
position: { type: [Number] },
|
||||
rotation: { type: [Number] },
|
||||
actions: [
|
||||
{
|
||||
uuid: { type: String, default: "" },
|
||||
name: { type: String, required: true },
|
||||
type: { type: String, required: true },
|
||||
material: { type: String, required: true },
|
||||
delay: { type: String, required: true },
|
||||
spawnInterval: { type: String, required: true },
|
||||
isUsed: { type: Boolean, required: true },
|
||||
name: { type: String },
|
||||
type: { type: String },
|
||||
material: { type: String },
|
||||
delay: { type: String },
|
||||
spawnInterval: { type: String },
|
||||
isUsed: { type: Boolean },
|
||||
hitCount: { type: String },
|
||||
start: { type: String },
|
||||
end: { type: String },
|
||||
buffer: { type: String },
|
||||
},
|
||||
],
|
||||
triggers: { type: [String], default: [] },
|
||||
// connections: {
|
||||
// source: {
|
||||
// pathUUID: { type: String, required: true },
|
||||
// pointUUID: { type: String, required: true },
|
||||
// },
|
||||
// targets: { type: [String], default: [] },
|
||||
// },
|
||||
triggers: [
|
||||
{
|
||||
uuid: { type: String, default: "" },
|
||||
name: { type: String },
|
||||
type: { type: String },
|
||||
bufferTime: { type: Number },
|
||||
isUsed: { type: Boolean },
|
||||
},
|
||||
],
|
||||
connections: {
|
||||
source: {
|
||||
pathUUID: { type: String },
|
||||
pointUUID: { type: String },
|
||||
},
|
||||
targets: [
|
||||
{
|
||||
pathUUID: { type: String },
|
||||
pointUUID: { type: String },
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
const BaseSchema = new Schema<IBaseModel>(
|
||||
@@ -66,7 +94,6 @@ const BaseSchema = new Schema<IBaseModel>(
|
||||
type: Schema.Types.Mixed,
|
||||
required: true,
|
||||
},
|
||||
speed: { type: Number },
|
||||
},
|
||||
{ discriminatorKey: "type", timestamps: true }
|
||||
);
|
||||
|
||||
@@ -1,38 +1,46 @@
|
||||
import mongoose, { Schema, Document, model } from "mongoose";
|
||||
import MainModel from "../../connect/mongoose.ts";
|
||||
|
||||
export interface Event extends Document {
|
||||
export interface Action extends Document {
|
||||
pointsUUID: string;
|
||||
actionUUID: string;
|
||||
// actionUUID: string;
|
||||
isArchive: string;
|
||||
sceneID: string;
|
||||
eventData: {
|
||||
uuid: string;
|
||||
type: string;
|
||||
material: string;
|
||||
delay: number;
|
||||
spawn_Interval: number;
|
||||
};
|
||||
// sceneID: string;
|
||||
// eventData: {
|
||||
uuid: string;
|
||||
name: string;
|
||||
type: string;
|
||||
material: string;
|
||||
delay: string;
|
||||
spawnInterval: string;
|
||||
isUsed: boolean;
|
||||
hitCount: number;
|
||||
start: string;
|
||||
end: string;
|
||||
buffer: number;
|
||||
// };
|
||||
}
|
||||
const eventSchema: Schema = new Schema(
|
||||
const actionSchema: Schema = new Schema(
|
||||
{
|
||||
pointsUUID: { type: String },
|
||||
isArchive: { type: Boolean, default: false },
|
||||
actionUUID: { type: String },
|
||||
eventData: [
|
||||
{
|
||||
uuid: { type: String },
|
||||
type: { type: String },
|
||||
material: { type: String },
|
||||
delay: { type: Number },
|
||||
spawn_Interval: { type: Number },
|
||||
},
|
||||
],
|
||||
// actionUUID: { type: String },
|
||||
uuid: { type: String, default: "" },
|
||||
name: { type: String },
|
||||
type: { type: String },
|
||||
material: { type: String },
|
||||
delay: { type: String },
|
||||
spawnInterval: { type: String },
|
||||
isUsed: { type: Boolean },
|
||||
hitCount: { type: String },
|
||||
start: { type: String },
|
||||
end: { type: String },
|
||||
buffer: { type: String },
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
const actionModel = (db: any) => {
|
||||
return MainModel(db, "Actions", eventSchema, "Actions");
|
||||
return MainModel(db, "Actions", actionSchema, "Actions");
|
||||
};
|
||||
export default actionModel;
|
||||
|
||||
@@ -3,32 +3,26 @@ import MainModel from "../../connect/mongoose.ts";
|
||||
|
||||
export interface Trigger extends Document {
|
||||
pointsUUID: string;
|
||||
actionUUID: string;
|
||||
// triggerUUID: string;
|
||||
isArchive: string;
|
||||
sceneID: string;
|
||||
triggerData: {
|
||||
uuid: string;
|
||||
type: string;
|
||||
// material: string;
|
||||
// delay: number;
|
||||
// spawn_Interval: number;
|
||||
};
|
||||
// sceneID: string;
|
||||
uuid: string;
|
||||
name: string;
|
||||
type: string;
|
||||
isUsed: boolean;
|
||||
bufferTime: 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 },
|
||||
},
|
||||
],
|
||||
// triggerUUID: { type: String },
|
||||
uuid: { type: String, default: "" },
|
||||
name: { type: String },
|
||||
type: { type: String },
|
||||
material: { type: String },
|
||||
delay: { type: String },
|
||||
isUsed: { type: Boolean },
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
44
src/shared/model/vizualization/3dwidget.ts
Normal file
44
src/shared/model/vizualization/3dwidget.ts
Normal 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;
|
||||
@@ -3,11 +3,19 @@ import MainModel from "../../connect/mongoose.ts";
|
||||
|
||||
export interface Template extends Document {
|
||||
templateName: string;
|
||||
templateID: string;
|
||||
snapshot: string;
|
||||
panelOrder: [];
|
||||
widgets: [];
|
||||
isArchive: boolean;
|
||||
}
|
||||
const templateSchema: Schema = new Schema(
|
||||
{
|
||||
templateName: { type: String },
|
||||
templateID: { type: String },
|
||||
snapshot: { type: String },
|
||||
panelOrder: { type: Array },
|
||||
widgets: { type: Array },
|
||||
isArchive: { type: Boolean, default: false },
|
||||
},
|
||||
{ timestamps: true }
|
||||
|
||||
@@ -14,7 +14,7 @@ export interface widget extends Document {
|
||||
isArchive: boolean;
|
||||
panelID: mongoose.Types.ObjectId;
|
||||
Data: {
|
||||
measurement: [any];
|
||||
measurements: {};
|
||||
duration: string;
|
||||
};
|
||||
}
|
||||
@@ -29,8 +29,8 @@ const widgetSchema: Schema = new Schema(
|
||||
fontFamily: { type: String },
|
||||
fontStyle: { type: String },
|
||||
Data: {
|
||||
measurements: { type: Array, default: [] },
|
||||
duration: { type: String, default: "1hr" },
|
||||
measurements: { type: Object, default: {} },
|
||||
duration: { type: String, default: "1h" },
|
||||
},
|
||||
fontWeight: { type: String },
|
||||
isArchive: { type: Boolean, default: false },
|
||||
|
||||
Reference in New Issue
Block a user