Asset point updated for the vehicle and conveyor widget 3D update delete routing completed
This commit is contained in:
@@ -4,4 +4,5 @@ const router = express.Router();
|
|||||||
router.post("/3dwidget/save", widget3dService.add3Dwidget);
|
router.post("/3dwidget/save", widget3dService.add3Dwidget);
|
||||||
router.get("/3dwidgetData/:zoneId/:organization", widget3dService.get3Dwiget);
|
router.get("/3dwidgetData/:zoneId/:organization", widget3dService.get3Dwiget);
|
||||||
router.get("/widget3D/:id/:organization", widget3dService.getSingle3Dwidget);
|
router.get("/widget3D/:id/:organization", widget3dService.getSingle3Dwidget);
|
||||||
|
router.patch("/widget3D/delete", widget3dService.delete3Dwidget);
|
||||||
export default router;
|
export default router;
|
||||||
|
|||||||
@@ -1,28 +1,10 @@
|
|||||||
import { Request, Response } from "express";
|
import { Request, Response } from "express";
|
||||||
import pointModel from "../../../shared/model/builder/assets/assetPoint-Model.ts";
|
import pointModel from "../../../shared/model/builder/assets/assetPoint-Model.ts";
|
||||||
interface ITriggerConveyor {
|
|
||||||
uuid: string;
|
|
||||||
name: string;
|
|
||||||
type: string;
|
|
||||||
isUsed: boolean;
|
|
||||||
bufferTime: number;
|
|
||||||
}
|
|
||||||
interface ITriggerVehicle {
|
|
||||||
uuid: string;
|
|
||||||
name: string;
|
|
||||||
type: string;
|
|
||||||
isUsed: boolean;
|
|
||||||
}
|
|
||||||
interface IConnection {
|
|
||||||
source: { pathUUID: string; pointUUID: string };
|
|
||||||
targets: { pathUUID: string; pointUUID: string }[];
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IPointBase {
|
interface IPointBase {
|
||||||
uuid: string;
|
uuid: string;
|
||||||
position: number[];
|
position: number[];
|
||||||
connections: IConnection;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IPointConveyor extends IPointBase {
|
interface IPointConveyor extends IPointBase {
|
||||||
rotation: number[];
|
rotation: number[];
|
||||||
actions: Array<{
|
actions: Array<{
|
||||||
@@ -41,25 +23,27 @@ interface IPointConveyor extends IPointBase {
|
|||||||
isUsed: boolean;
|
isUsed: boolean;
|
||||||
bufferTime: number;
|
bufferTime: number;
|
||||||
}>;
|
}>;
|
||||||
|
connections: {
|
||||||
|
source: { pathUUID: string; pointUUID: string };
|
||||||
|
targets: Array<{ pathUUID: string; pointUUID: string }>;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IPointVehicle extends IPointBase {
|
interface IPointVehicle extends IPointBase {
|
||||||
actions: Array<{
|
actions: {
|
||||||
uuid: string;
|
uuid: string;
|
||||||
name: string;
|
name: string;
|
||||||
type: string;
|
type: string;
|
||||||
isUsed: boolean;
|
|
||||||
hitCount: number;
|
hitCount: number;
|
||||||
start: string;
|
start: { x: number; y: number } | {};
|
||||||
end: string;
|
end: { x: number; y: number } | {};
|
||||||
buffer: number;
|
buffer: number;
|
||||||
}>;
|
};
|
||||||
triggers: Array<{
|
connections: {
|
||||||
uuid: string;
|
source: { modelUUID: string; pointUUID: string };
|
||||||
name: string;
|
targets: Array<{ pathUUID: string; pointUUID: string }>;
|
||||||
type: string;
|
};
|
||||||
isUsed: boolean;
|
speed: number;
|
||||||
}>;
|
|
||||||
}
|
}
|
||||||
export class pointService {
|
export class pointService {
|
||||||
static async addPoints(req: Request, res: Response): Promise<any> {
|
static async addPoints(req: Request, res: Response): Promise<any> {
|
||||||
@@ -188,31 +172,31 @@ export class pointService {
|
|||||||
const vehiclePoint: IPointVehicle = {
|
const vehiclePoint: IPointVehicle = {
|
||||||
uuid: "point1UUID",
|
uuid: "point1UUID",
|
||||||
position: [0, 1.3, 0],
|
position: [0, 1.3, 0],
|
||||||
actions: [
|
actions: {
|
||||||
{
|
|
||||||
uuid: "randomUUID",
|
uuid: "randomUUID",
|
||||||
name: "Action 1",
|
name: "Action 1",
|
||||||
type: "string",
|
type: "string",
|
||||||
hitCount: 1,
|
hitCount: 1,
|
||||||
isUsed: false,
|
start: { x: 0, y: 0 },
|
||||||
start: "start",
|
end: { x: 0, y: 0 },
|
||||||
end: "end",
|
|
||||||
buffer: 0,
|
buffer: 0,
|
||||||
},
|
},
|
||||||
],
|
|
||||||
triggers: [
|
|
||||||
{ uuid: "string", name: "string", type: "string", isUsed: false },
|
|
||||||
],
|
|
||||||
connections: {
|
connections: {
|
||||||
source: { pathUUID: "modelUUID", pointUUID: "point1UUID" },
|
source: { modelUUID: "modelUUID", pointUUID: "point1UUID" },
|
||||||
targets: [{ pathUUID: "modelUUID", pointUUID: "point1UUID" }],
|
targets: [{ pathUUID: "modelUUID", pointUUID: "point1UUID" }],
|
||||||
},
|
},
|
||||||
|
speed: 2,
|
||||||
};
|
};
|
||||||
if ("rotation" in vehiclePoint) {
|
if ("rotation" in vehiclePoint) {
|
||||||
return res
|
return res
|
||||||
.status(400)
|
.status(400)
|
||||||
.json({ error: "Rotation not allowed for Vehicle points" });
|
.json({ error: "Rotation not allowed for Vehicle points" });
|
||||||
}
|
}
|
||||||
|
if ("triggers" in vehiclePoint) {
|
||||||
|
return res
|
||||||
|
.status(400)
|
||||||
|
.json({ error: "Triggers not allowed for Vehicle points" });
|
||||||
|
}
|
||||||
|
|
||||||
await pointModel(organization).create({
|
await pointModel(organization).create({
|
||||||
...baseData,
|
...baseData,
|
||||||
@@ -248,56 +232,3 @@ export class pointService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to remove `_id` recursively
|
|
||||||
// const removeIdRecursively = (obj: any): any => {
|
|
||||||
// if (Array.isArray(obj)) {
|
|
||||||
// return obj.map(removeIdRecursively);
|
|
||||||
// } else if (obj !== null && typeof obj === "object") {
|
|
||||||
// const { _id, ...rest } = obj; // Remove `_id`
|
|
||||||
// return Object.keys(rest).reduce((acc, key) => {
|
|
||||||
// acc[key] = removeIdRecursively(rest[key]); // Recursively clean nested objects
|
|
||||||
// return acc;
|
|
||||||
// }, {} as any);
|
|
||||||
// }
|
|
||||||
// return obj;
|
|
||||||
// };
|
|
||||||
// static async gettypePoints(req: Request, res: Response): Promise<any> {
|
|
||||||
// const { modelfileID, organization } = req.params;
|
|
||||||
// try {
|
|
||||||
// const { ConveyorModel, VehicleModel } = pointModel(organization);
|
|
||||||
|
|
||||||
// const conveyorData = await ConveyorModel.findOne({ modelfileID })
|
|
||||||
// .select("-_id -createdAt -updatedAt")
|
|
||||||
// .lean();
|
|
||||||
|
|
||||||
// const vehicleData = await VehicleModel.findOne({ modelfileID })
|
|
||||||
// .select("-_id -createdAt -updatedAt")
|
|
||||||
// .lean();
|
|
||||||
|
|
||||||
// if (!conveyorData && !vehicleData) {
|
|
||||||
// return res.status(404).json({ message: "Data not found" });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const combinedData = [conveyorData, vehicleData].filter(Boolean);
|
|
||||||
|
|
||||||
// const formattedData = combinedData.map((data) => {
|
|
||||||
// const typedData = data as any;
|
|
||||||
|
|
||||||
// return {
|
|
||||||
// modelfileID: typedData.modelfileID,
|
|
||||||
// type: typedData.type,
|
|
||||||
// points: Array.isArray(typedData.points)
|
|
||||||
// ? typedData.points.map((point: any) => ({
|
|
||||||
// position: point.position,
|
|
||||||
// rotation: point.rotation,
|
|
||||||
// }))
|
|
||||||
// : [],
|
|
||||||
// };
|
|
||||||
// });
|
|
||||||
|
|
||||||
// return res.status(200).json(formattedData);
|
|
||||||
// } catch (error) {
|
|
||||||
// res.status(500).json({ message: "Server error", error });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|||||||
@@ -1,70 +1,8 @@
|
|||||||
import { Request, Response } from "express";
|
import { Request, Response } from "express";
|
||||||
// import assetModel from "../../../shared/model/assets/flooritems-Model.ts";
|
|
||||||
import assetModel from "../../../shared/model/builder/assets/asset-Model.ts";
|
import assetModel from "../../../shared/model/builder/assets/asset-Model.ts";
|
||||||
import actionModel from "../../../shared/model/simulation/actionmodel.ts";
|
import actionModel from "../../../shared/model/simulation/actionmodel.ts";
|
||||||
import triggerModel from "../../../shared/model/simulation/triggersmodel.ts";
|
import triggerModel from "../../../shared/model/simulation/triggersmodel.ts";
|
||||||
import pointModel from "../../../shared/model/builder/assets/assetPoint-Model.ts";
|
import pointModel from "../../../shared/model/builder/assets/assetPoint-Model.ts";
|
||||||
interface ITriggerConveyor {
|
|
||||||
uuid: string;
|
|
||||||
name: string;
|
|
||||||
type: string;
|
|
||||||
isUsed: boolean;
|
|
||||||
bufferTime: number;
|
|
||||||
}
|
|
||||||
interface ITriggerVehicle {
|
|
||||||
uuid: string;
|
|
||||||
name: string;
|
|
||||||
type: string;
|
|
||||||
isUsed: boolean;
|
|
||||||
}
|
|
||||||
interface IConnection {
|
|
||||||
source: { pathUUID: string; pointUUID: string };
|
|
||||||
targets: { pathUUID: string; pointUUID: string }[];
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IPointBase {
|
|
||||||
uuid: string;
|
|
||||||
position: number[];
|
|
||||||
connections: IConnection;
|
|
||||||
}
|
|
||||||
interface IPointConveyor extends IPointBase {
|
|
||||||
rotation: number[];
|
|
||||||
actions: Array<{
|
|
||||||
uuid: string;
|
|
||||||
name: string;
|
|
||||||
type: string;
|
|
||||||
material: string;
|
|
||||||
delay: number | string;
|
|
||||||
spawnInterval: number | string;
|
|
||||||
isUsed: boolean;
|
|
||||||
}>;
|
|
||||||
triggers: Array<{
|
|
||||||
uuid: string;
|
|
||||||
name: string;
|
|
||||||
type: string;
|
|
||||||
isUsed: boolean;
|
|
||||||
bufferTime: number;
|
|
||||||
}>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IPointVehicle extends IPointBase {
|
|
||||||
actions: Array<{
|
|
||||||
uuid: string;
|
|
||||||
name: string;
|
|
||||||
type: string;
|
|
||||||
isUsed: boolean;
|
|
||||||
hitCount: number;
|
|
||||||
start: string;
|
|
||||||
end: string;
|
|
||||||
buffer: number;
|
|
||||||
}>;
|
|
||||||
triggers: Array<{
|
|
||||||
uuid: string;
|
|
||||||
name: string;
|
|
||||||
type: string;
|
|
||||||
isUsed: boolean;
|
|
||||||
}>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class assetsFloorservice {
|
export class assetsFloorservice {
|
||||||
static async setFloorassets(req: Request, res: Response): Promise<any> {
|
static async setFloorassets(req: Request, res: Response): Promise<any> {
|
||||||
@@ -162,6 +100,7 @@ export class assetsFloorservice {
|
|||||||
// return res.send("Type mismatch");
|
// return res.send("Type mismatch");
|
||||||
// }
|
// }
|
||||||
if (eventData.type === "Conveyor") {
|
if (eventData.type === "Conveyor") {
|
||||||
|
assetData.speed = eventData.speed;
|
||||||
// console.log("eventData.points: ", typeof eventData.points);
|
// console.log("eventData.points: ", typeof eventData.points);
|
||||||
// if (!Array.isArray(eventData.points) || eventData.points) {
|
// if (!Array.isArray(eventData.points) || eventData.points) {
|
||||||
// return res
|
// return res
|
||||||
@@ -174,22 +113,27 @@ export class assetsFloorservice {
|
|||||||
// .json({ message: "Invalid Conveyor point structure" });
|
// .json({ message: "Invalid Conveyor point structure" });
|
||||||
// }
|
// }
|
||||||
} else if (eventData.type === "Vehicle") {
|
} else if (eventData.type === "Vehicle") {
|
||||||
console.log("eventData.points: ", typeof eventData.points);
|
assetData.speed = eventData.points.speed;
|
||||||
if (!eventData.points) {
|
if (!eventData.points) {
|
||||||
return res
|
return res
|
||||||
.status(400)
|
.status(400)
|
||||||
.json({ message: "Vehicle points must be a single object" });
|
.json({ message: "Vehicle points must be a single object" });
|
||||||
}
|
}
|
||||||
|
// if(eventData.poin)
|
||||||
if (eventData.points.rotation) {
|
if (eventData.points.rotation) {
|
||||||
return res.status(400).json({
|
return res.status(400).json({
|
||||||
message: "Rotation is not allowed for Vehicle points",
|
message: "Rotation is not allowed for Vehicle points",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (eventData.points.triggers) {
|
||||||
|
return res.status(400).json({
|
||||||
|
message: "triggers is not allowed for Vehicle points",
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("eventData.points: ", eventData.points);
|
|
||||||
assetData.points = eventData.points;
|
assetData.points = eventData.points;
|
||||||
assetData.speed = eventData.speed;
|
|
||||||
assetData.type = eventData.type;
|
assetData.type = eventData.type;
|
||||||
}
|
}
|
||||||
// if (eventData) {
|
// if (eventData) {
|
||||||
@@ -280,7 +224,10 @@ export class assetsFloorservice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const response = findValues.map((item) => {
|
const response = findValues.map((item) => {
|
||||||
console.log("item.points: ", item.points);
|
console.log("item: ", item);
|
||||||
|
console.log("item: ", item.type);
|
||||||
|
// console.log('findValues: ', findValues);
|
||||||
|
// console.log("item.points: ", item.points);
|
||||||
const responseItem: any = {
|
const responseItem: any = {
|
||||||
modeluuid: item.modeluuid,
|
modeluuid: item.modeluuid,
|
||||||
modelname: item.modelname,
|
modelname: item.modelname,
|
||||||
@@ -300,7 +247,6 @@ export class assetsFloorservice {
|
|||||||
|
|
||||||
if (item.type === "Vehicle" && item.points) {
|
if (item.type === "Vehicle" && item.points) {
|
||||||
responseItem.eventData = {
|
responseItem.eventData = {
|
||||||
speed: item.speed,
|
|
||||||
type: item.type,
|
type: item.type,
|
||||||
points: item.points,
|
points: item.points,
|
||||||
};
|
};
|
||||||
@@ -311,7 +257,6 @@ export class assetsFloorservice {
|
|||||||
|
|
||||||
return res.status(200).json(response);
|
return res.status(200).json(response);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error get flooritems:", error);
|
|
||||||
res.status(500).json({ error: "Failed to get flooritems" });
|
res.status(500).json({ error: "Failed to get flooritems" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -330,7 +275,6 @@ export class assetsFloorservice {
|
|||||||
res.status(201).json(findValue);
|
res.status(201).json(findValue);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error get flooritems:", error);
|
|
||||||
res.status(500).json({ error: "Failed to get flooritems" });
|
res.status(500).json({ error: "Failed to get flooritems" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -373,7 +317,6 @@ export class assetsFloorservice {
|
|||||||
}
|
}
|
||||||
static async replaceEventDatas(req: Request, res: Response): Promise<any> {
|
static async replaceEventDatas(req: Request, res: Response): Promise<any> {
|
||||||
const { organization, modeluuid, eventData } = req.body;
|
const { organization, modeluuid, eventData } = req.body;
|
||||||
console.log("req.body: ", req.body);
|
|
||||||
try {
|
try {
|
||||||
const existingModel = await assetModel(organization).findOne({
|
const existingModel = await assetModel(organization).findOne({
|
||||||
modeluuid: modeluuid,
|
modeluuid: modeluuid,
|
||||||
@@ -382,14 +325,20 @@ export class assetsFloorservice {
|
|||||||
if (!existingModel)
|
if (!existingModel)
|
||||||
return res.json({ message: "Model not for this UUID" });
|
return res.json({ message: "Model not for this UUID" });
|
||||||
else {
|
else {
|
||||||
|
let speed;
|
||||||
|
if (existingModel.type === "Conveyor") {
|
||||||
|
speed = eventData?.speed;
|
||||||
|
}
|
||||||
|
// if (existingModel.type === "Vehicle") {
|
||||||
|
// speed = eventData?.points?.speed;
|
||||||
|
// }
|
||||||
const updatedModel = await assetModel(organization).findOneAndUpdate(
|
const updatedModel = await assetModel(organization).findOneAndUpdate(
|
||||||
{ modeluuid, isArchive: false },
|
{ modeluuid, isArchive: false },
|
||||||
{
|
{
|
||||||
$set: {
|
points: eventData?.points,
|
||||||
points: eventData.points,
|
// speed: speed,
|
||||||
speed: eventData.speed,
|
type: eventData?.type || existingModel?.type,
|
||||||
type: eventData.type,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{ new: true }
|
{ new: true }
|
||||||
);
|
);
|
||||||
@@ -398,7 +347,7 @@ export class assetsFloorservice {
|
|||||||
return res.status(200).json({ message: "Data updated successfully" });
|
return res.status(200).json({ message: "Data updated successfully" });
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
res.status(500).json({ message: "Server error", error: error.message });
|
return res.status(500).send(error.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export class widget3dService {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
position: widget?.position,
|
position: widget?.position,
|
||||||
|
rotation: widget?.rotation,
|
||||||
Data: {
|
Data: {
|
||||||
measurements: widget?.Data.measurements,
|
measurements: widget?.Data.measurements,
|
||||||
duration: widget?.Data.duration,
|
duration: widget?.Data.duration,
|
||||||
@@ -44,6 +45,7 @@ export class widget3dService {
|
|||||||
type: widget.type,
|
type: widget.type,
|
||||||
widgetID: widget.id,
|
widgetID: widget.id,
|
||||||
position: widget.position,
|
position: widget.position,
|
||||||
|
rotation: widget.rotation,
|
||||||
zoneId,
|
zoneId,
|
||||||
});
|
});
|
||||||
if (newWidget3d)
|
if (newWidget3d)
|
||||||
@@ -128,4 +130,37 @@ export class widget3dService {
|
|||||||
return res.status(500).send(error.message);
|
return res.status(500).send(error.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static async delete3Dwidget(req: Request, res: Response): Promise<any> {
|
||||||
|
const { organization, id, zoneId } = req.body;
|
||||||
|
try {
|
||||||
|
const existingZone = await zoneSchema(organization).findOne({
|
||||||
|
zoneId: zoneId,
|
||||||
|
isArchive: false,
|
||||||
|
});
|
||||||
|
if (!existingZone)
|
||||||
|
return res.status(404).json({ message: "Zone not found" });
|
||||||
|
const existing3Dwidget = await widget3dModel(organization).findOne({
|
||||||
|
widgetID: id,
|
||||||
|
isArchive: false,
|
||||||
|
zoneId: zoneId,
|
||||||
|
});
|
||||||
|
if (!existing3Dwidget) {
|
||||||
|
return res.send("3D widget not found for the ID");
|
||||||
|
}
|
||||||
|
const updateWidget = await widget3dModel(organization).findOneAndUpdate(
|
||||||
|
{
|
||||||
|
widgetID: id,
|
||||||
|
zoneId: zoneId,
|
||||||
|
isArchive: false,
|
||||||
|
},
|
||||||
|
{ isArchive: true },
|
||||||
|
{ new: true }
|
||||||
|
);
|
||||||
|
if (!updateWidget)
|
||||||
|
return res.json({ message: "3DWidget delete unsuccessfull" });
|
||||||
|
return res.status(200).json({ message: "3DWidget deleted successfully" });
|
||||||
|
} catch (error: any) {
|
||||||
|
return res.status(500).send(error.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,9 +102,6 @@ export class panelService {
|
|||||||
{ $pull: { panelOrder: existingPanel.panelName } }
|
{ $pull: { panelOrder: existingPanel.panelName } }
|
||||||
);
|
);
|
||||||
console.log("zonepanelname: ", zonepanelname);
|
console.log("zonepanelname: ", zonepanelname);
|
||||||
// existingZone.panelOrder.splice(index1, 1);
|
|
||||||
// existingZone.markModified("panelOrder"); // Mark modified
|
|
||||||
// await existingZone.save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return res.status(200).json({ message: "Panel deleted successfully" });
|
return res.status(200).json({ message: "Panel deleted successfully" });
|
||||||
|
|||||||
@@ -2,30 +2,33 @@ import mongoose, { Schema, Document } from "mongoose";
|
|||||||
import MainModel from "../../../connect/mongoose.ts";
|
import MainModel from "../../../connect/mongoose.ts";
|
||||||
|
|
||||||
// Common Interfaces
|
// Common Interfaces
|
||||||
interface ITriggerConveyor {
|
// interface ITriggerConveyor {
|
||||||
uuid: string;
|
// uuid: string;
|
||||||
name: string;
|
// name: string;
|
||||||
type: string;
|
// type: string;
|
||||||
isUsed: boolean;
|
// isUsed: boolean;
|
||||||
bufferTime: number;
|
// bufferTime: number;
|
||||||
}
|
// }
|
||||||
interface ITriggerVehicle {
|
// interface ITriggerVehicle {
|
||||||
uuid: string;
|
// uuid: string;
|
||||||
name: string;
|
// name: string;
|
||||||
type: string;
|
// type: string;
|
||||||
isUsed: boolean;
|
// isUsed: boolean;
|
||||||
}
|
// }
|
||||||
|
|
||||||
interface IConnection {
|
// interface IConnectionConveyor {
|
||||||
source: { pathUUID: string; pointUUID: string };
|
// source: { pathUUID: string; pointUUID: string };
|
||||||
targets: { pathUUID: string; pointUUID: string }[];
|
// targets: { pathUUID: string; pointUUID: string }[];
|
||||||
}
|
// }
|
||||||
|
// interface IConnectionVehicle {
|
||||||
|
// source: { modelUUID: string; pointUUID: string };
|
||||||
|
// targets: { pathUUID: string; pointUUID: string }[];
|
||||||
|
// }
|
||||||
|
|
||||||
// Point Types
|
// Point Types
|
||||||
interface IPointBase {
|
interface IPointBase {
|
||||||
uuid: string;
|
uuid: string;
|
||||||
position: number[];
|
position: number[];
|
||||||
connections: IConnection;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IPointConveyor extends IPointBase {
|
interface IPointConveyor extends IPointBase {
|
||||||
@@ -46,25 +49,27 @@ interface IPointConveyor extends IPointBase {
|
|||||||
isUsed: boolean;
|
isUsed: boolean;
|
||||||
bufferTime: number;
|
bufferTime: number;
|
||||||
}>;
|
}>;
|
||||||
|
connections: {
|
||||||
|
source: { pathUUID: string; pointUUID: string };
|
||||||
|
targets: Array<{ pathUUID: string; pointUUID: string }>;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IPointVehicle extends IPointBase {
|
interface IPointVehicle extends IPointBase {
|
||||||
actions: Array<{
|
actions: {
|
||||||
uuid: string;
|
uuid: string;
|
||||||
name: string;
|
name: string;
|
||||||
type: string;
|
type: string;
|
||||||
isUsed: boolean;
|
|
||||||
hitCount: number;
|
hitCount: number;
|
||||||
start: string;
|
start: { x: number; y: number } | {};
|
||||||
end: string;
|
end: { x: number; y: number } | {};
|
||||||
buffer: number;
|
buffer: number;
|
||||||
}>;
|
};
|
||||||
triggers: Array<{
|
speed: number;
|
||||||
uuid: string;
|
connections: {
|
||||||
name: string;
|
source: { modelUUID: string; pointUUID: string };
|
||||||
type: string;
|
targets: Array<{ pathUUID: string; pointUUID: string }>;
|
||||||
isUsed: boolean;
|
};
|
||||||
}>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main Document Interface
|
// Main Document Interface
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ export interface Widget3d extends Document {
|
|||||||
widgetID: string;
|
widgetID: string;
|
||||||
widgetName: string;
|
widgetName: string;
|
||||||
position: [];
|
position: [];
|
||||||
|
rotation: [];
|
||||||
isArchive: boolean;
|
isArchive: boolean;
|
||||||
zoneId: string;
|
zoneId: string;
|
||||||
Data: {
|
Data: {
|
||||||
@@ -19,6 +20,7 @@ const Widget3dSchema: Schema = new Schema(
|
|||||||
widgetID: { type: String },
|
widgetID: { type: String },
|
||||||
widgetName: { type: String, default: "Widget3D" },
|
widgetName: { type: String, default: "Widget3D" },
|
||||||
position: { type: Array },
|
position: { type: Array },
|
||||||
|
rotation: { type: Array },
|
||||||
zoneId: { type: String },
|
zoneId: { type: String },
|
||||||
Data: {
|
Data: {
|
||||||
measurements: { type: Object, default: {} },
|
measurements: { type: Object, default: {} },
|
||||||
|
|||||||
@@ -1,45 +1,44 @@
|
|||||||
const swaggerAutogen = require('swagger-autogen')
|
const swaggerAutogen = require("swagger-autogen");
|
||||||
|
|
||||||
const dotenv = require('dotenv')
|
const dotenv = require("dotenv");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
const envPath = path.resolve(__dirname, "../../../.env");
|
const envPath = path.resolve(__dirname, "../../../.env");
|
||||||
|
|
||||||
|
|
||||||
dotenv.config({ path: envPath });
|
dotenv.config({ path: envPath });
|
||||||
const ip = require('ip')
|
const ip = require("ip");
|
||||||
const PORT = process.env.API_PORT;
|
const PORT = process.env.API_PORT;
|
||||||
|
|
||||||
const doc = {
|
const doc = {
|
||||||
info: {
|
info: {
|
||||||
title: 'dwinzo documentation',
|
title: "dwinzo documentation",
|
||||||
description: 'Description'
|
description: "Description",
|
||||||
},
|
},
|
||||||
host: '185.100.212.76:5000',
|
// host: "185.100.212.76:5000",
|
||||||
basePath: '/api/v1',
|
host: "192.168.0.102:5000",
|
||||||
schemes: ['http'],
|
// basePath: "/api/v1",
|
||||||
|
schemes: ["http"],
|
||||||
};
|
};
|
||||||
|
|
||||||
const outputFile = './../../../swagger-output.json';
|
const outputFile = "./../../../swagger-output.json";
|
||||||
const routes = [
|
const routes = [
|
||||||
'./../../api-server/Routes/user-Routes.ts',
|
"./../../api-server/Routes/user-Routes.ts",
|
||||||
'./../../api-server/Routes/camera-Routes.ts',
|
"./../../api-server/Routes/camera-Routes.ts",
|
||||||
'./../../api-server/Routes/environments-Routes.ts',
|
"./../../api-server/Routes/environments-Routes.ts",
|
||||||
'./../../api-server/Routes/flooritem-Routes.ts',
|
"./../../api-server/Routes/flooritem-Routes.ts",
|
||||||
'./../../api-server/Routes/lines-Routes.ts',
|
"./../../api-server/Routes/lines-Routes.ts",
|
||||||
'./../../api-server/Routes/share-Routes.ts',
|
"./../../api-server/Routes/share-Routes.ts",
|
||||||
'./../../api-server/Routes/wallItems-Routes.ts',
|
"./../../api-server/Routes/wallItems-Routes.ts",
|
||||||
|
"./../../api-server/Routes/floadWidgetRoute.ts",
|
||||||
|
"./../../api-server/Routes/panelRoutes.ts",
|
||||||
|
"./../../api-server/Routes/templateRoutes.ts",
|
||||||
|
"./../../api-server/Routes/widget3dRoutes.ts",
|
||||||
|
"./../../api-server/Routes/widgetRoute.ts",
|
||||||
|
"./../../api-server/Routes/assetfloorRoutes.ts",
|
||||||
|
"./../../api-server/Routes/assetpointRoutes.ts",
|
||||||
|
"./../../api-server/Routes/zoneRoutes.ts",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
swaggerAutogen()(outputFile, routes, doc).then(() => {
|
swaggerAutogen()(outputFile, routes, doc).then(() => {
|
||||||
console.log('Swagger documentation generated!');
|
console.log("Swagger documentation generated!");
|
||||||
|
});
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -158,8 +158,6 @@ export const setAssetModel = async (data: any) => {
|
|||||||
organization,
|
organization,
|
||||||
} = data;
|
} = data;
|
||||||
console.log("data: ", data);
|
console.log("data: ", data);
|
||||||
// const position=data.position
|
|
||||||
// const rotation=data.rotation
|
|
||||||
try {
|
try {
|
||||||
const findvalue = await assetModel(organization).findOne({
|
const findvalue = await assetModel(organization).findOne({
|
||||||
modeluuid: modeluuid,
|
modeluuid: modeluuid,
|
||||||
@@ -168,7 +166,6 @@ export const setAssetModel = async (data: any) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (findvalue) {
|
if (findvalue) {
|
||||||
console.log("findvalue: ", findvalue);
|
|
||||||
const updatevalue = await assetModel(organization).findOneAndUpdate(
|
const updatevalue = await assetModel(organization).findOneAndUpdate(
|
||||||
{ modeluuid: modeluuid, modelname: modelname, isArchive: false },
|
{ modeluuid: modeluuid, modelname: modelname, isArchive: false },
|
||||||
{
|
{
|
||||||
@@ -198,25 +195,10 @@ export const setAssetModel = async (data: any) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (eventData) {
|
if (eventData) {
|
||||||
// console.log("checkpointType?.type: ", checkpointType?.type);
|
|
||||||
// console.log("eventData.typ: ", eventData.type);
|
|
||||||
// if (checkpointType?.type !== eventData.type) {
|
|
||||||
// return res.send("Type mismatch");
|
|
||||||
// }
|
|
||||||
if (eventData.type === "Conveyor") {
|
if (eventData.type === "Conveyor") {
|
||||||
// console.log("eventData.points: ", typeof eventData.points);
|
assetData.speed = eventData.speed;
|
||||||
// if (!Array.isArray(eventData.points) || eventData.points) {
|
|
||||||
// return res
|
|
||||||
// .status(400)
|
|
||||||
// .json({ message: "Points must be an array" });
|
|
||||||
// }
|
|
||||||
// if (!eventData.points.every(validateConveyorPoint)) {
|
|
||||||
// return res
|
|
||||||
// .status(400)
|
|
||||||
// .json({ message: "Invalid Conveyor point structure" });
|
|
||||||
// }
|
|
||||||
} else if (eventData.type === "Vehicle") {
|
} else if (eventData.type === "Vehicle") {
|
||||||
console.log("eventData.points: ", typeof eventData.points);
|
assetData.speed = eventData.points.speed;
|
||||||
if (!eventData.points) {
|
if (!eventData.points) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
@@ -231,16 +213,22 @@ export const setAssetModel = async (data: any) => {
|
|||||||
organization: organization,
|
organization: organization,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if (eventData.points.triggers) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
message: "triggers is not allowed for Vehicle points",
|
||||||
|
organization: organization,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
assetData.points = eventData.points;
|
assetData.points = eventData.points;
|
||||||
assetData.speed = eventData.speed;
|
|
||||||
assetData.type = eventData.type;
|
assetData.type = eventData.type;
|
||||||
}
|
}
|
||||||
const assetDoc = await assetModel(organization).create(assetData);
|
const assetDoc = await assetModel(organization).create(assetData);
|
||||||
await assetDoc.save();
|
await assetDoc.save();
|
||||||
// await assetDoc.save();
|
let assetDatas;
|
||||||
// if(assetDoc.)
|
if (assetDoc.type === "Conveyor") {
|
||||||
const assetDatas = {
|
assetDatas = {
|
||||||
modeluuid: assetDoc.modeluuid,
|
modeluuid: assetDoc.modeluuid,
|
||||||
modelname: assetDoc.modelname,
|
modelname: assetDoc.modelname,
|
||||||
modelfileID: assetDoc.modelfileID,
|
modelfileID: assetDoc.modelfileID,
|
||||||
@@ -254,6 +242,22 @@ export const setAssetModel = async (data: any) => {
|
|||||||
speed: assetDoc.speed,
|
speed: assetDoc.speed,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
if (assetDoc.type === "Vehicle") {
|
||||||
|
assetDatas = {
|
||||||
|
modeluuid: assetDoc.modeluuid,
|
||||||
|
modelname: assetDoc.modelname,
|
||||||
|
modelfileID: assetDoc.modelfileID,
|
||||||
|
position: assetDoc.position,
|
||||||
|
rotation: assetDoc.rotation,
|
||||||
|
isLocked: assetDoc.isLocked,
|
||||||
|
isVisible: assetDoc.isVisible,
|
||||||
|
eventData: {
|
||||||
|
points: assetDoc.points,
|
||||||
|
type: assetDoc.type,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
message: "Model created successfully",
|
message: "Model created successfully",
|
||||||
@@ -304,3 +308,51 @@ export const deleteAssetModel = async (data: any) => {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
export const replaceEventDatas = async (data: any) => {
|
||||||
|
const { organization, modeluuid, eventData } = data;
|
||||||
|
try {
|
||||||
|
const existingModel = await assetModel(organization).findOne({
|
||||||
|
modeluuid: modeluuid,
|
||||||
|
isArchive: false,
|
||||||
|
});
|
||||||
|
if (!existingModel)
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
message: "Model not for this UUID",
|
||||||
|
organization: organization,
|
||||||
|
};
|
||||||
|
else {
|
||||||
|
let speed;
|
||||||
|
if (existingModel.type === "Conveyor") {
|
||||||
|
speed = eventData?.speed;
|
||||||
|
}
|
||||||
|
// if (existingModel.type === "Vehicle") {
|
||||||
|
// speed = eventData?.points?.speed;
|
||||||
|
// }
|
||||||
|
const updatedModel = await assetModel(organization).findOneAndUpdate(
|
||||||
|
{ modeluuid, isArchive: false },
|
||||||
|
{
|
||||||
|
points: eventData?.points,
|
||||||
|
// speed: speed,
|
||||||
|
type: eventData?.type || existingModel?.type,
|
||||||
|
},
|
||||||
|
{ new: true }
|
||||||
|
);
|
||||||
|
|
||||||
|
if (updatedModel)
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
message: "Data updated successfully",
|
||||||
|
data: updatedModel,
|
||||||
|
organization: organization,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} catch (error: any) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
message: error?.message || "Error occurred while ModelAsset",
|
||||||
|
error,
|
||||||
|
organization: organization,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
@@ -5,14 +5,66 @@
|
|||||||
"description": "Description",
|
"description": "Description",
|
||||||
"version": "1.0.0"
|
"version": "1.0.0"
|
||||||
},
|
},
|
||||||
"host": "185.100.212.76:5000",
|
"host": "192.168.0.102:5000",
|
||||||
"basePath": "/api/v1",
|
"schemes": ["http"],
|
||||||
"schemes": [
|
"tags": [
|
||||||
"http"
|
{
|
||||||
|
"name": "Authentication",
|
||||||
|
"description": "User authentication endpoints"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Camera",
|
||||||
|
"description": "Camera management endpoints"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Environment",
|
||||||
|
"description": "Environment configuration"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Floor Items",
|
||||||
|
"description": "Floor items management"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Lines",
|
||||||
|
"description": "Line drawing operations"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Walls",
|
||||||
|
"description": "Wall items management"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Zones",
|
||||||
|
"description": "Zone operations"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Users Management",
|
||||||
|
"description": "User sharing and permissions"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "3D widgets",
|
||||||
|
"description": "3D widgets operations"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Panels",
|
||||||
|
"description": "Panels operations"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Floating Widgets",
|
||||||
|
"description": "Floating widgets operations"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Assets",
|
||||||
|
"description": "ModelAssets operations"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Asset Points",
|
||||||
|
"description": "Asset based structure Points"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"paths": {
|
"paths": {
|
||||||
"/signup": {
|
"/api/v1/signup": {
|
||||||
"post": {
|
"post": {
|
||||||
|
"tags": ["Authentication"],
|
||||||
"description": "",
|
"description": "",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -50,8 +102,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/login": {
|
"/api/v1/login": {
|
||||||
"post": {
|
"post": {
|
||||||
|
"tags": ["Authentication"],
|
||||||
"description": "",
|
"description": "",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -86,8 +139,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/setCamera": {
|
"/api/v1/setCamera": {
|
||||||
"post": {
|
"post": {
|
||||||
|
"tags": ["Camera"],
|
||||||
"description": "",
|
"description": "",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -125,8 +179,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/getCamera/{organization}/{userId}": {
|
"/api/v1/getCamera/{organization}/{userId}": {
|
||||||
"get": {
|
"get": {
|
||||||
|
"tags": ["Camera"],
|
||||||
"description": "",
|
"description": "",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -155,8 +210,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/activeCameras/{organization}": {
|
"/api/v1/activeCameras/{organization}": {
|
||||||
"get": {
|
"get": {
|
||||||
|
"tags": ["Camera"],
|
||||||
"description": "",
|
"description": "",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -176,8 +232,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/setEvironments": {
|
"/api/v1/setEvironments": {
|
||||||
"post": {
|
"post": {
|
||||||
|
"tags": ["Environment"],
|
||||||
"description": "",
|
"description": "",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -212,8 +269,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/findEnvironments/{organization}/{userId}": {
|
"/api/v1/findEnvironments/{organization}/{userId}": {
|
||||||
"get": {
|
"get": {
|
||||||
|
"tags": ["Environment"],
|
||||||
"description": "",
|
"description": "",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -242,8 +300,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/setfloorItems": {
|
"/api/v1/setfloorItems": {
|
||||||
"post": {
|
"post": {
|
||||||
|
"tags": ["Floor Items"],
|
||||||
"description": "",
|
"description": "",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -290,8 +349,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/findfloorItems/{organization}": {
|
"/api/v1/findfloorItems/{organization}": {
|
||||||
"get": {
|
"get": {
|
||||||
|
"tags": ["Floor Items"],
|
||||||
"description": "",
|
"description": "",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -314,8 +374,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/deletefloorItem": {
|
"/api/v1/deletefloorItem": {
|
||||||
"delete": {
|
"delete": {
|
||||||
|
"tags": ["Floor Items"],
|
||||||
"description": "",
|
"description": "",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -350,8 +411,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/setLine": {
|
"/api/v1/setLine": {
|
||||||
"post": {
|
"post": {
|
||||||
|
"tags": ["Lines"],
|
||||||
"description": "",
|
"description": "",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -386,8 +448,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/updatePoint": {
|
"/api/v1/updatePoint": {
|
||||||
"post": {
|
"post": {
|
||||||
|
"tags": ["Lines"],
|
||||||
"description": "",
|
"description": "",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -419,8 +482,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/findLines/{organization}": {
|
"/api/v1/findLines/{organization}": {
|
||||||
"get": {
|
"get": {
|
||||||
|
"tags": ["Lines"],
|
||||||
"description": "",
|
"description": "",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -443,8 +507,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/deleteLine": {
|
"/api/v1/deleteLine": {
|
||||||
"delete": {
|
"delete": {
|
||||||
|
"tags": ["Lines"],
|
||||||
"description": "",
|
"description": "",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -482,8 +547,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/deletePoint": {
|
"/api/v1/deletePoint": {
|
||||||
"delete": {
|
"delete": {
|
||||||
|
"tags": ["Lines"],
|
||||||
"description": "",
|
"description": "",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -521,8 +587,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/deleteLayer": {
|
"/api/v1/deleteLayer": {
|
||||||
"post": {
|
"post": {
|
||||||
|
"tags": ["Lines"],
|
||||||
"description": "",
|
"description": "",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -554,8 +621,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/shareUser": {
|
"/api/v1/shareUser": {
|
||||||
"post": {
|
"post": {
|
||||||
|
"tags": ["Users Management"],
|
||||||
"description": "",
|
"description": "",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -590,8 +658,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/findshareUsers": {
|
"/api/v1/findshareUsers": {
|
||||||
"get": {
|
"get": {
|
||||||
|
"tags": ["Users Management"],
|
||||||
"description": "",
|
"description": "",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -613,8 +682,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/setWallItems": {
|
"/api/v1/setWallItems": {
|
||||||
"post": {
|
"post": {
|
||||||
|
"tags": ["Walls"],
|
||||||
"description": "",
|
"description": "",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -664,8 +734,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/findWallItems/{organization}": {
|
"/api/v1/findWallItems/{organization}": {
|
||||||
"get": {
|
"get": {
|
||||||
|
"tags": ["Walls"],
|
||||||
"description": "",
|
"description": "",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -688,8 +759,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/deleteWallItem": {
|
"/api/v1/deleteWallItem": {
|
||||||
"delete": {
|
"delete": {
|
||||||
|
"tags": ["Walls"],
|
||||||
"description": "",
|
"description": "",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -723,6 +795,149 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"/api/v2/zone/save": {
|
||||||
|
"post": {
|
||||||
|
"tags": ["Zones"],
|
||||||
|
"description": "Create or update a zone",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "body",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"organization": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "NEWORG"
|
||||||
|
},
|
||||||
|
"zonesdata": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"zonename": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Zone 2"
|
||||||
|
},
|
||||||
|
"zoneId": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "576-65-6-659"
|
||||||
|
},
|
||||||
|
"points": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"x": { "type": "number" },
|
||||||
|
"y": { "type": "number" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"example": [
|
||||||
|
[{ "x": 5, "y": 5 }],
|
||||||
|
[{ "x": 5, "y": 5 }],
|
||||||
|
[{ "x": 0, "y": 0 }]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"viewportPosition": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"x": { "type": "number" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"example": [{ "x": 0 }]
|
||||||
|
},
|
||||||
|
"viewPortCenter": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"x": { "type": "number" },
|
||||||
|
"y": { "type": "number" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"userid": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"layer": {
|
||||||
|
"type": "number",
|
||||||
|
"example": 1
|
||||||
|
},
|
||||||
|
"sceneID": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"zonename",
|
||||||
|
"zoneId",
|
||||||
|
"points",
|
||||||
|
"viewportPosition",
|
||||||
|
"layer"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["organization", "zonesdata"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"message": { "type": "string" },
|
||||||
|
"zoneData": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"zoneName": { "type": "string" },
|
||||||
|
"points": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"x": { "type": "number" },
|
||||||
|
"y": { "type": "number" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"viewPortposition": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"x": { "type": "number" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"viewPortCenter": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"x": { "type": "number" },
|
||||||
|
"y": { "type": "number" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"201": {
|
||||||
|
"description": "Created"
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "Zone not updated"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user