RT-Vis 2d and floating widget API collaboration completed, template Save and get API completed. SOCKET 2d panel and widgets events completed

This commit is contained in:
2025-03-29 17:47:16 +05:30
parent 7c0e59edad
commit 834abbab29
16 changed files with 1037 additions and 824 deletions

View File

@@ -1,107 +1,107 @@
import mongoose, { Schema, Document } from "mongoose";
import MainModel from "../../../connect/mongoose.ts";
interface IAction {
uuid: string;
name: string;
type: string;
material: string;
delay: string;
spawnInterval: string;
isUsed: boolean;
hitCount: number;
start: string;
end: string;
buffer: number;
}
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: ITriggers[];
connections: IConnection;
}
interface IBaseModel extends Document {
modelfileID: string;
type: "Conveyor" | "Vehicle";
points: IPoint[] | IPoint;
}
// Base Schema
const PointSchema = new Schema<IPoint>({
uuid: { type: String, required: true },
position: { type: [Number] },
rotation: { type: [Number] },
actions: [
{
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 },
},
],
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>(
{
modelfileID: { type: String },
type: { type: String, enum: ["Conveyor", "Vehicle"] },
points: {
type: Schema.Types.Mixed,
required: true,
},
},
{ discriminatorKey: "type", timestamps: true }
);
const pointModel = (db: string) => {
return MainModel(db, "Points", BaseSchema, "Points");
};
export default pointModel;
// const pointModel = mongoose.model<IBaseModel>("Points", BaseSchema, "Points");
// export default pointModel;
import mongoose, { Schema, Document } from "mongoose";
import MainModel from "../../../connect/mongoose.ts";
interface IAction {
uuid: string;
name: string;
type: string;
material: string;
delay: string;
spawnInterval: string;
isUsed: boolean;
hitCount: number;
start: string;
end: string;
buffer: number;
}
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: ITriggers[];
connections: IConnection;
}
interface IBaseModel extends Document {
modelfileID: string;
type: "Conveyor" | "Vehicle";
points: IPoint[] | IPoint;
}
// Base Schema
const PointSchema = new Schema<IPoint>({
uuid: { type: String, required: true },
position: { type: [Number] },
rotation: { type: [Number] },
actions: [
{
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 },
},
],
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>(
{
modelfileID: { type: String },
type: { type: String, enum: ["Conveyor", "Vehicle"] },
points: {
type: Schema.Types.Mixed,
required: true,
},
},
{ discriminatorKey: "type", timestamps: true }
);
const pointModel = (db: string) => {
return MainModel(db, "Points", BaseSchema, "Points");
};
export default pointModel;
// const pointModel = mongoose.model<IBaseModel>("Points", BaseSchema, "Points");
// export default pointModel;

View File

@@ -1,44 +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;
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;