fetch req conflict resolved
This commit is contained in:
@@ -245,7 +245,7 @@ const router = express.Router();
|
||||
* type: string
|
||||
* example: "Internal server error"
|
||||
*/
|
||||
router.post("/zone/save", ZoneService.addandUpdateZone);
|
||||
router.post("/zone/save", ZoneService.addandUpdateZone);
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
|
||||
@@ -11,16 +11,8 @@ import {
|
||||
|
||||
const v1Zone = express.Router();
|
||||
|
||||
v1Zone.post(
|
||||
"/zones",
|
||||
tokenValidator,
|
||||
CreateZoneController
|
||||
);
|
||||
v1Zone.patch(
|
||||
"/zones/delete",
|
||||
tokenValidator,
|
||||
DeleteZoneController
|
||||
);
|
||||
v1Zone.post("/zones", tokenValidator, CreateZoneController);
|
||||
v1Zone.patch("/zones/delete", tokenValidator, DeleteZoneController);
|
||||
|
||||
v1Zone.get(
|
||||
"/zones/visualization/:projectId",
|
||||
@@ -38,9 +30,5 @@ v1Zone.get(
|
||||
tokenValidator,
|
||||
SingleZonePanelController
|
||||
);
|
||||
v1Zone.get(
|
||||
"/zones/:projectId",
|
||||
tokenValidator,
|
||||
GetZoneController
|
||||
);
|
||||
v1Zone.get("/zones/:projectId", tokenValidator, GetZoneController);
|
||||
export default v1Zone;
|
||||
|
||||
@@ -238,25 +238,6 @@ export class ZoneService {
|
||||
return res.status(500).send(error.message);
|
||||
}
|
||||
}
|
||||
static async getZones(req: Request, res: Response) {
|
||||
try {
|
||||
const { organization } = req.params;
|
||||
|
||||
const findZoneId = await zoneSchema(organization)
|
||||
.find({isArchive:false})
|
||||
.select(
|
||||
"zoneId zoneName layer points viewPortCenter viewPortposition -_id"
|
||||
);
|
||||
|
||||
if (!findZoneId) {
|
||||
res.status(500).json({ message: "Invalid zone" });
|
||||
}
|
||||
res.status(201).json({ data: findZoneId, organization: organization });
|
||||
} catch (error) {
|
||||
console.log("error: ", error);
|
||||
res.status(500).json({ message: "Zone not found", error });
|
||||
}
|
||||
}
|
||||
static async lockedPanel(req: Request, res: Response): Promise<any> {
|
||||
console.log(req.body);
|
||||
const organization = req.body.organization;
|
||||
@@ -290,4 +271,24 @@ export class ZoneService {
|
||||
return res.status(500).send(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
static async getZones(req: Request, res: Response) {
|
||||
try {
|
||||
const { organization } = req.params;
|
||||
|
||||
const findZoneId = await zoneSchema(organization)
|
||||
.find({ isArchive: false })
|
||||
.select(
|
||||
"zoneId zoneName layer points viewPortCenter viewPortposition -_id"
|
||||
);
|
||||
|
||||
if (!findZoneId) {
|
||||
res.status(500).json({ message: "Invalid zone" });
|
||||
}
|
||||
res.status(200).json({ data: findZoneId, organization: organization });
|
||||
} catch (error) {
|
||||
console.log("error: ", error);
|
||||
res.status(500).json({ message: "Zone not found", error });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user