AssetData connections added, 3dWidget update and get added
This commit is contained in:
@@ -87,13 +87,18 @@ export class assetsFloorservice {
|
||||
triggerRefs.push(triggerDoc._id);
|
||||
}
|
||||
}
|
||||
// point.connections{
|
||||
// source:{
|
||||
|
||||
// }
|
||||
// }
|
||||
pointRefs.push({
|
||||
uuid: point.uuid,
|
||||
position: point.position || [],
|
||||
rotation: point.rotation || [],
|
||||
actions: actionRefs,
|
||||
triggers: triggerRefs,
|
||||
connections: point.connections,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,14 @@ export class widget3dService {
|
||||
zoneId: zoneId,
|
||||
isArchive: false,
|
||||
},
|
||||
{ position: widget.position },
|
||||
{
|
||||
position: widget?.position,
|
||||
Data: {
|
||||
measurements: widget?.Data.measurements,
|
||||
duration: widget?.Data.duration,
|
||||
},
|
||||
widgetName: widget?.widgetName,
|
||||
},
|
||||
{ upsert: true, new: true }
|
||||
);
|
||||
if (update3dwidget)
|
||||
@@ -34,7 +41,7 @@ export class widget3dService {
|
||||
else return res.send("Widget not updated");
|
||||
}
|
||||
const newWidget3d = await widget3dModel(organization).create({
|
||||
widgetName: widget.type,
|
||||
type: widget.type,
|
||||
widgetID: widget.id,
|
||||
position: widget.position,
|
||||
zoneId,
|
||||
@@ -66,7 +73,7 @@ export class widget3dService {
|
||||
measurements: widget.Data?.measurements || {},
|
||||
duration: widget.Data?.duration || "1h",
|
||||
},
|
||||
type: widget.widgetName,
|
||||
type: widget.type,
|
||||
id: widget.widgetID,
|
||||
position: widget.position,
|
||||
}));
|
||||
@@ -103,4 +110,22 @@ export class widget3dService {
|
||||
// return res.status(500).send(error.message);
|
||||
// }
|
||||
// }
|
||||
static async getSingle3Dwidget(req: Request, res: Response): Promise<any> {
|
||||
const { organization, id } = req.params;
|
||||
try {
|
||||
const widgetData = await widget3dModel(organization).findOne({
|
||||
widgetID: id,
|
||||
isArchive: false,
|
||||
});
|
||||
if (!widgetData) return res.send("WidgetID not found");
|
||||
const structureData = {
|
||||
measurements: widgetData?.Data.measurements,
|
||||
duration: widgetData?.Data.duration,
|
||||
};
|
||||
const widgetName = widgetData.widgetName;
|
||||
return res.status(200).json({ Data: structureData, widgetName });
|
||||
} catch (error: any) {
|
||||
return res.status(500).send(error.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ export class widgetService {
|
||||
$set: {
|
||||
// panelID: existingPanel._id,
|
||||
// widgetID: widget.id,
|
||||
widgetName: widget.widgetName,
|
||||
widgetName: widget?.widgetName,
|
||||
Data: {
|
||||
measurements: widget.Data?.measurements || {},
|
||||
duration: widget.Data?.duration || "1h",
|
||||
@@ -69,7 +69,7 @@ export class widgetService {
|
||||
widgetID: widget.id,
|
||||
elementType: widget.type,
|
||||
// widgetOrder: widgetOrder,
|
||||
widgetName: widget.widgetName,
|
||||
widgetName: widget.title,
|
||||
panelID: existingPanel._id,
|
||||
widgetside: widget.panel,
|
||||
// Data: {
|
||||
|
||||
Reference in New Issue
Block a user