Zone rename, model rename, clear panel and locked panel API and socket completed

This commit is contained in:
2025-04-09 18:22:12 +05:30
parent c4d8fc14c8
commit 40eb9d8fb9
12 changed files with 450 additions and 124 deletions

View File

@@ -30,6 +30,7 @@ interface IPointConveyor extends IPointBase {
}
interface IPointVehicle extends IPointBase {
rotation: number[];
actions: {
uuid: string;
name: string;
@@ -51,33 +52,34 @@ interface IPointArmbot extends IPointBase {
uuid: string;
name: string;
speed: number;
processes: { triggerId: string; startPoint: string; endPoint: string }[]
processes: { triggerId: string; startPoint: string; endPoint: string }[];
};
triggers: { uuid: string; name: string; type: string };
connections: {
source: { modelUUID: string; pointUUID: string };
targets: { modelUUID: string; pointUUID: string }[]
targets: { modelUUID: string; pointUUID: string }[];
};
}
interface IPointStaticMachine extends IPointBase{
interface IPointStaticMachine extends IPointBase {
rotation: number[];
actions: {
uuid: string;
name: string;
buffer: number | string;
material: string;
},
};
triggers: { uuid: string; name: string; type: string };
connections: {
source: { modelUUID: string; pointUUID: string };
targets: { modelUUID: string; pointUUID: string }[] };
connections: {
source: { modelUUID: string; pointUUID: string };
targets: { modelUUID: string; pointUUID: string }[];
};
}
export class pointService {
static async addPoints(req: Request, res: Response): Promise<any> {
const { type, modelfileID, organization } = req.body;
// Validate type
if (!["Conveyor", "Vehicle","ArmBot","StaticMachine"].includes(type)) {
if (!["Conveyor", "Vehicle", "ArmBot", "StaticMachine"].includes(type)) {
return res.status(400).json({ message: "Invalid type requested" });
}
@@ -189,8 +191,7 @@ export class pointService {
...baseData,
points: conveyorPoints,
});
}
if (type === "Vehicle") {
} else if (type === "Vehicle") {
console.log("vehcile data");
const baseData = {
modelfileID: "67e3da19c2e8f37134526e6a",
@@ -198,6 +199,7 @@ export class pointService {
};
const vehiclePoint: IPointVehicle = {
uuid: "point1UUID",
rotation: [0, 0, 0],
position: [0, 1.3, 0],
actions: {
uuid: "randomUUID",
@@ -214,11 +216,6 @@ export class pointService {
},
speed: 2,
};
if ("rotation" in vehiclePoint) {
return res
.status(400)
.json({ error: "Rotation not allowed for Vehicle points" });
}
if ("triggers" in vehiclePoint) {
return res
.status(400)
@@ -229,8 +226,7 @@ export class pointService {
...baseData,
points: vehiclePoint,
});
}
if (type === "ArmBot") {
} else if (type === "ArmBot") {
console.log("ArmBot data");
const baseData = {
modelfileID: "67eb7904c2e8f37134527eae",
@@ -239,27 +235,35 @@ export class pointService {
const ArmBotPoint: IPointArmbot = {
uuid: "point1UUID",
position: [0, 2.75, -0.5],
rotation:[0,0,0],
rotation: [0, 0, 0],
actions: {
uuid: "randomUUID",
name: "Action 1",
speed:1,
processes:[{triggerId:"triggerId",startPoint:"startPoint",endPoint:"endPoint"}]
speed: 1,
processes: [
{
triggerId: "triggerId",
startPoint: "startPoint",
endPoint: "endPoint",
},
],
},
triggers: {
uuid: "randomUUID",
name: "trigger 1",
type: "OnComplete",
},
triggers: { uuid: "randomUUID", name: "trigger 1", type: "OnComplete" },
connections: {
source: { modelUUID: "modelUUID", pointUUID: "point1UUID" },
targets: [{ modelUUID: "modelUUID", pointUUID: "point1UUID" }],
},
};
await pointModel(organization).create({
...baseData,
points: ArmBotPoint,
});
}
if (type === "StaticMachine") {
} else if (type === "StaticMachine") {
console.log("StaticMachine data");
const baseData = {
modelfileID: "67e3db5ac2e8f37134526f40",
@@ -268,26 +272,31 @@ export class pointService {
const StaticMachinePoint: IPointStaticMachine = {
uuid: "point1UUID",
position: [0, 1.5, -0.5],
rotation:[0,0,0],
rotation: [0, 0, 0],
actions: {
uuid: "randomUUID",
name: "Action 1",
buffer: 0, material: "Inherit",
buffer: 0,
material: "Inherit",
},
triggers: {
uuid: "randomUUID",
name: "trigger 1",
type: "OnComplete",
},
triggers: { uuid: "randomUUID", name: "trigger 1", type: "OnComplete" },
connections: {
source: { modelUUID: "modelUUID", pointUUID: "point1UUID" },
targets: [{ modelUUID: "modelUUID", pointUUID: "point1UUID" }],
},
};
await pointModel(organization).create({
...baseData,
points: StaticMachinePoint,
});
} else {
return res.json({ message: "Requested type mismatch" });
}
return res.status(201).json({ message: "Points created successfully" });
} catch (error) {
return res.status(500).json({