zone response zone-points added

This commit is contained in:
2025-04-11 09:23:44 +05:30
parent 40eb9d8fb9
commit c15ca51b9f
3 changed files with 75 additions and 40 deletions

View File

@@ -108,7 +108,7 @@ export class Zoneservice {
isArchive: false,
})
.select(
"panelOrder zoneName zonePoints lockedPanel zoneId viewPortCenter viewPortposition"
"panelOrder zoneName zonePoints lockedPanel zoneId viewPortCenter viewPortposition points"
);
if (!existingZone) {
return res.send({ message: "Zone not found for the UUID" });
@@ -146,7 +146,7 @@ export class Zoneservice {
activeSides: existingZone.panelOrder || [],
panelOrder: existingZone.panelOrder || [],
lockedPanels: existingZone.lockedPanel || [],
points: existingZone.zonePoints || [],
points: existingZone.points || [],
widgets: flattenedWidgets,
};
@@ -166,7 +166,7 @@ export class Zoneservice {
isArchive: false,
})
.select(
"panelOrder zoneName zonePoints lockedPanel zoneId viewPortCenter viewPortposition"
"panelOrder zoneName zonePoints lockedPanel zoneId viewPortCenter viewPortposition points"
);
if (!existingZones) {
return res.send({ message: "Zone not found for the UUID" });
@@ -205,7 +205,7 @@ export class Zoneservice {
activeSides: zone.panelOrder || [],
panelOrder: zone.panelOrder || [],
lockedPanels: zone.lockedPanel || [],
points: zone.zonePoints || [],
points: zone.points || [],
widgets: widgets.flat(),
};
})

View File

@@ -6,6 +6,7 @@ export class widgetService {
static async addWidget(req: Request, res: Response): Promise<any> {
try {
// console.log("req.body: ", req.body);
console.log("req.body: ", req.body);
const {
organization,
// panel,
@@ -57,7 +58,6 @@ export class widgetService {
},
{ upsert: true, new: true } // Upsert: create if not exists, new: return updated document
);
console.log("updateWidget: ", updateWidget);
return res
.status(200)
.json({ message: "Widget updated successfully" });
@@ -95,8 +95,8 @@ export class widgetService {
static async deleteWidget(req: Request, res: Response): Promise<any> {
try {
const { widgetID, organization,zoneId} = req.body;
console.log(' req.body: ', req.body);
const { widgetID, organization, zoneId } = req.body;
console.log(" req.body: ", req.body);
const findWidget = await widgetSchema(organization).findOne({
zoneId: zoneId,
widgetID: widgetID,
@@ -105,7 +105,7 @@ export class widgetService {
if (!findWidget)
return res.status(409).json({ message: "Widget not found" });
const widgetData = await widgetSchema(organization).updateOne(
{ _id: findWidget._id, isArchive: false,zoneId: zoneId },
{ _id: findWidget._id, isArchive: false, zoneId: zoneId },
{ $set: { isArchive: true } }
);
@@ -142,6 +142,7 @@ export class widgetService {
static async updatewidget(req: Request, res: Response): Promise<any> {
try {
console.log("req.body: ", req.body);
const { organization, widgetID, values } = req.body;
const findwidget = await widgetSchema(organization).findOne({
widgetID: widgetID,