Testing failer uncomment issue sorted API-Docker updated based on the Failed testcase
This commit is contained in:
@@ -2,7 +2,7 @@ import { Request, Response } from "express";
|
||||
import zoneSchema from "../../../shared/model/builder/lines/zone-Model.ts";
|
||||
import panelSchema from "../../../shared/model/vizualization/panelmodel.ts";
|
||||
import widgetSchema from "../../../shared/model/vizualization/widgemodel.ts";
|
||||
export class Zoneservice {
|
||||
export class ZoneService {
|
||||
static async addandUpdateZone(req: Request, res: Response): Promise<any> {
|
||||
try {
|
||||
const organization = req.body.organization;
|
||||
@@ -33,13 +33,6 @@ export class Zoneservice {
|
||||
},
|
||||
});
|
||||
} else {
|
||||
// const existingZoneName = await zoneSchema(organization).find({
|
||||
// zoneName: zoneDatas.zoneName,
|
||||
// isArchive: false,
|
||||
// });
|
||||
// if (existingZoneName.length > 0) {
|
||||
// return res.json({ message: "Zone name already exists" });
|
||||
// }
|
||||
const replaceZone = await zoneSchema(organization).findOneAndUpdate(
|
||||
{ zoneId: zoneDatas.zoneId, isArchive: false },
|
||||
{
|
||||
@@ -96,7 +89,6 @@ export class Zoneservice {
|
||||
}
|
||||
}
|
||||
|
||||
//single zode panel and widget data
|
||||
static async singleZonePanelDatas(req: Request, res: Response): Promise<any> {
|
||||
const organization = req.query.organization;
|
||||
const zoneId = req.params.zoneId;
|
||||
@@ -157,7 +149,6 @@ export class Zoneservice {
|
||||
}
|
||||
}
|
||||
|
||||
//page full zone Datas with panel and widget
|
||||
static async vizAllDatas(req: Request, res: Response): Promise<any> {
|
||||
const organization = req.query.organization;
|
||||
try {
|
||||
@@ -173,13 +164,11 @@ export class Zoneservice {
|
||||
} else {
|
||||
const response = await Promise.all(
|
||||
existingZones.map(async (zone) => {
|
||||
// Fetch all panels associated with the current zone
|
||||
const panelData = await panelSchema(organization).find({
|
||||
zoneId: zone._id,
|
||||
isArchive: false,
|
||||
});
|
||||
|
||||
// Fetch widgets for each panel
|
||||
const widgets = await Promise.all(
|
||||
panelData.map(async (panel) => {
|
||||
const widgetDataArray = await widgetSchema(organization).find({
|
||||
@@ -218,7 +207,6 @@ export class Zoneservice {
|
||||
}
|
||||
}
|
||||
|
||||
//only for the name and zoneID
|
||||
static async allZones(req: Request, res: Response): Promise<any> {
|
||||
const organization = req.query.organization;
|
||||
const sceneID = req.params.sceneID || "scene123";
|
||||
@@ -244,7 +232,7 @@ export class Zoneservice {
|
||||
const findZone = await zoneSchema(organization).findOne({
|
||||
zoneId: zoneId,
|
||||
});
|
||||
// .select("zoneName");
|
||||
|
||||
if (findZone) return res.status(200).json(findZone);
|
||||
} catch (error: any) {
|
||||
return res.status(500).send(error.message);
|
||||
@@ -284,21 +272,4 @@ export class Zoneservice {
|
||||
return res.status(500).send(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
// static async zoneIdgenerate(req: Request, res: Response): Promise<any> {
|
||||
// const organization = req.query.organization;
|
||||
// const sceneID = req.params.sceneID;
|
||||
// try {
|
||||
// const Allzones = await zoneSchema(organization)
|
||||
// .find({ sceneID: sceneID, isArchive: false })
|
||||
// .select("zoneName sceneID zoneId");
|
||||
|
||||
// if (!Allzones || Allzones.length === 0) {
|
||||
// return res.send({ message: "Zone not found for the UUID" });
|
||||
// }
|
||||
// return res.send(Allzones);
|
||||
// } catch (error: any) {
|
||||
// return res.status(500).send(error.message);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user