template ,float,3dWidget socket events creation

This commit is contained in:
2025-04-02 16:47:02 +05:30
parent bfe56693b9
commit 61d0a8c4ed
6 changed files with 433 additions and 149 deletions

View File

@@ -1,50 +1,55 @@
import zoneSchema from "../../../shared/model/builder/lines/zone-Model.ts";
import widget3dModel from "../../../shared/model/vizualization/3dwidget.ts";
export const add3Dwidget = async (data: any) => {
const { organization, widget, zoneId } = data
const { organization, widget, zoneId } = data
console.log('data: ', data)
try {
const existingZone = await zoneSchema(organization).findOne({
try {
const existingZone = await zoneSchema(organization).findOne({
zoneId: zoneId,
isArchive: false,
});
if (!existingZone)
return { success: false, message: "Zone not found for the zoneId", organization: organization }
const existing3Dwidget = await widget3dModel(organization).findOne({
widgetID: widget.id,
isArchive: false,
});
if (existing3Dwidget) {
const update3dwidget = await widget3dModel(
organization
).findOneAndUpdate(
{
widgetID: widget.id,
zoneId: zoneId,
isArchive: false,
});
if (!existingZone)
return { success: false, message: "Zone not found for the zoneId", organization: organization }
const existing3Dwidget = await widget3dModel(organization).findOne({
widgetID: widget.id,
isArchive: false,
});
if (existing3Dwidget) {
const update3dwidget = await widget3dModel(
organization
).findOneAndUpdate(
{
widgetID: widget.id,
zoneId: zoneId,
isArchive: false,
},
{ position: widget.position },
{ upsert: true, new: true }
);
if (update3dwidget)
return { success: true, message:"widget update successfully", organization: organization }
},
{ position: widget.position },
{ upsert: true, new: true }
);
if (update3dwidget)
return { success: true, message: "widget update successfully", organization: organization }
else return{ success: false, message: "Widget not updated", organization: organization }
}
const newWidget3d = await widget3dModel(organization).create({
widgetName: widget.type,
widgetID: widget.id,
position: widget.position,
zoneId,
});
if (newWidget3d)
return { success: false, message: "Widget created successfully",data:newWidget3d, organization: organization }
} catch (error: any) {
return { success: false, message: error?.message || "Error occurred while 3Dwidget", error, organization: organization }
else return { success: false, message: "Widget not updated", organization: organization }
}
const newWidget3d = await widget3dModel(organization).create({
widgetName: widget.type,
widgetID: widget.id,
position: widget.position,
zoneId,
});
if (newWidget3d) {
const widgemodel3D_Datas = {
widget: { id: newWidget3d.widgetID, type: newWidget3d.widgetName, position: newWidget3d.position, },
Data: newWidget3d.Data, zoneId: zoneId,
}
return { success: true, message: "Widget created successfully", data: widgemodel3D_Datas, organization: organization }
}
} catch (error: any) {
return { success: false, message: error?.message || "Error occurred while 3Dwidget", error, organization: organization }
}
}

View File

@@ -1,9 +1,8 @@
import floatWidgetModel from "../../../shared/model/vizualization/3dwidget.ts";
import floatWidgetModel from "../../../shared/model/vizualization/floatWidget.ts";
import zoneSchema from "../../../shared/model/builder/lines/zone-Model.ts";
export const addfloat = async (data: any) => {
const { organization, widget, zoneId } = data;
console.log('data: ', data);
const { organization, widget, zoneId, index } = data;
try {
const existingZone = await zoneSchema(organization).findOne({
zoneId: zoneId,
@@ -29,9 +28,9 @@ export const addfloat = async (data: any) => {
Data: {
measurements: widget?.Data.measurements,
duration: widget?.Data.duration,
},
header: widget?.header,
position: widget?.position,
},
header: widget?.header,
position: widget?.position,
},
},
{
@@ -39,7 +38,12 @@ export const addfloat = async (data: any) => {
new: true,
}
);
return { success: true, message: "Widget updated successfully", data: updateFloatWidget, organization: organization }
const floatUpdateDatas = {
position: updateFloatWidget.position,
index: index,
zoneId: zoneId, zoneName: existingZone.zoneName
}
return { success: true, message: "Widget updated successfully", data: floatUpdateDatas, organization: organization }
}
const newFloadWidget = await floatWidgetModel(organization).create({
@@ -52,7 +56,83 @@ export const addfloat = async (data: any) => {
zoneId: zoneId,
});
if (newFloadWidget) {
return { success: true, message: "FloatWidget created successfully", data: newFloadWidget, organization: organization }
const floatDatas = {
widget: {
position: newFloadWidget.position, header: newFloadWidget.header, value: newFloadWidget.value
, per: newFloadWidget.per, className: newFloadWidget.className, id: newFloadWidget.floatWidgetID
},
zoneId: zoneId, zoneName: existingZone.zoneName
}
return { success: true, message: "FloatWidget created successfully", data: floatDatas, organization: organization }
}
} catch (error: any) {
return { success: false, message: error?.message || "Error occurred while float", error, organization: organization }
}
}
export const duplicatefloat = async (data: any) => {
const { organization, widget, zoneId, index } = data;
try {
const existingZone = await zoneSchema(organization).findOne({
zoneId: zoneId,
isArchive: false,
});
if (!existingZone)
return { success: false, message: "Zone not found for the zoneId", organization: organization }
const existingFloatWidget = await floatWidgetModel(organization).findOne({
floatWidgetID: widget.id,
isArchive: false,
zoneId: zoneId,
});
if (existingFloatWidget) {
const updateFloatWidget = await floatWidgetModel(organization).findOneAndUpdate(
{
floatWidgetID: widget.id,
isArchive: false,
},
{
$set: {
Data: {
measurements: widget?.Data.measurements,
duration: widget?.Data.duration,
},
header: widget?.header,
position: widget?.position,
},
},
{
upsert: true,
new: true,
}
);
const floatUpdateDatas = {
position: updateFloatWidget.position,
index: index,
zoneId: zoneId, zoneName: existingZone.zoneName
}
return { success: true, message: "Widget updated successfully", data: floatUpdateDatas, organization: organization }
}
const newFloadWidget = await floatWidgetModel(organization).create({
className: widget.className,
header: widget.header,
floatWidgetID: widget.id,
position: widget.position,
per: widget.per,
value: widget.value,
zoneId: zoneId,
});
if (newFloadWidget) {
const floatDatas = {
widget: {
position: newFloadWidget.position, header: newFloadWidget.header, value: newFloadWidget.value
, per: newFloadWidget.per, className: newFloadWidget.className, id: newFloadWidget.floatWidgetID
},
zoneId: zoneId, zoneName: existingZone.zoneName,index:index
}
return { success: true, message: "duplicate FloatWidget created successfully", data: floatDatas, organization: organization }
}
} catch (error: any) {
return { success: false, message: error?.message || "Error occurred while float", error, organization: organization }
@@ -60,25 +140,36 @@ export const addfloat = async (data: any) => {
}
export const deletefloat = async (data: any) => {
const { floatWidgetID, organization } = data;
console.log('data: ', data);
const { floatWidgetID, zoneId, organization } = data;
try {
const existingZone = await zoneSchema(organization).findOne({
zoneId: zoneId,
isArchive: false,
});
if (!existingZone)
return { success: false, message: "Zone not found for the zoneId", organization: organization }
const findfloatWidget = await floatWidgetModel(organization).findOne({
floatWidgetID: floatWidgetID,
isArchive: false,
floatWidgetID: floatWidgetID,
isArchive: false,
});
if (!findfloatWidget)
return { success: false, message: "Zone not found for the zoneId", organization: organization }
const widgetData = await floatWidgetModel(organization).updateOne(
{ _id: findfloatWidget._id, isArchive: false },
{ $set: { isArchive: true } }
{ _id: findfloatWidget._id, isArchive: false },
{ $set: { isArchive: true } }
);
return { success: true, message: "FloatingWidget deleted successfully", data: widgetData, organization: organization }
const floatDeleteData = {
floatWidgetID: findfloatWidget.floatWidgetID,
zoneId: findfloatWidget.zoneId,
zoneName: existingZone.zoneName
} catch (error: any) {
}
return { success: true, message: "FloatingWidget deleted successfully", data: floatDeleteData, organization: organization }
} catch (error: any) {
return { success: false, message: error?.message || "Error occurred while float", error, organization: organization }
}
}
}

View File

@@ -1,26 +1,203 @@
import templateModel from "../../../shared/model/vizualization/templatemodel.ts";
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";
import floatWidgetModel from "../../../shared/model/vizualization/floatWidget.ts";
export const addTemplate = async (data: any) => {
const { organization, templateID, name, panelOrder, widgets, snapshot } =data;
console.log('data: ', data);
try {
const existingTemplate = await templateModel(organization).findOne({
templateID: templateID,
const { organization, template, name, panelOrder, widgets, snapshot } = data;
console.log('data: ', data);
try {
// console.log("req.body: ", req.body);
const existingTemplate = await templateModel(organization).findOne({
templateID: template.id,
isArchive: false,
});
if (existingTemplate)
return { success: false, message: "TemplateID alreay exists", organization: organization }
const newTemplate = await templateModel(organization).create({
templateID: template.id,
templateName: template.name,
panelOrder: template.panelOrder,
widgets: template.widgets,
snapshot: template.snapshot,
floatWidgets: template.floatingWidget,
Widgets3D: template.Widgets3D,
});
if (newTemplate) {
const allTemplateDatas = await templateModel(organization)
.find({ isArchive: false })
.select("-_id -__v -isArchive -createdAt -updatedAt");
const formattedTemplates = allTemplateDatas.map((data) => ({
id: data.templateID,
name: data.templateName,
panelOrder: data.panelOrder,
widgets: data.widgets,
floatingWidget: data.floatWidgets,
widgets3D: data.Widgets3D,
snapshot: data.snapshot,
}));
return {
success: true,
message: "Template saved successfully",
data: formattedTemplates,
organization: organization,
};
}
} catch (error: any) {
return { success: false, message: error?.message || "Error occurred while template", error, organization: organization }
}
}
export const addTemplateZone = async (data: any) => {
const { zoneId, templateID, organization } = data;
try {
const existingZone = await zoneSchema(organization).findOne({
zoneId: zoneId,
isArchive: false,
});
if (!existingZone)
return { success: false, message: "Zone not found ", organization: organization }
const existingTemplate = await templateModel(organization).findOne({
templateID: templateID,
isArchive: false,
});
if (!existingTemplate)
return { success: false, message: "TemplateID not found", organization: organization }
if (existingZone.panelOrder.length > 0) {
existingZone.panelOrder = existingTemplate.panelOrder;
await existingZone.save();
// Clear existing data before adding new data
const archivePanelDatas = await panelSchema(organization).find({
zoneId,
isArchive: false,
});
for (const panelData of archivePanelDatas) {
await widgetSchema(organization).deleteMany({
panelID: panelData._id,
isArchive: false,
});
if (existingTemplate)
return { success: false, message: "TemplateID alreay exists", organization: organization }
const newTemplate = await templateModel(organization).create({
templateID,
name,
panelOrder,
widgets,
snapshot,
});
if (newTemplate)
return { success: false, message: "Template saved successfully", data: newTemplate, organization: organization }
} catch (error: any) {
return { success: false, message: error?.message || "Error occurred while template", error, organization: organization }
}
await panelSchema(organization).deleteMany({
zoneId,
isArchive: false,
});
await floatWidgetModel(organization).deleteMany({
zoneId,
isArchive: false,
});
}
existingZone.panelOrder = existingTemplate.panelOrder;
await existingZone.save();
const existingPanels = await panelSchema(organization).find({
zoneId,
isArchive: false,
});
const existingPanelNames = existingPanels.map(
(panel: any) => panel.panelName
);
const missingPanels = existingTemplate.panelOrder.filter(
(panelName: string) => !existingPanelNames.includes(panelName)
);
const createdPanels = await Promise.all(
missingPanels.map((panelName: any) =>
panelSchema(organization).create({
zoneId,
panelName,
widgets: [],
isArchive: false,
})
)
);
for (const widgetData of existingTemplate.widgets) {
const addedExistingPanel = await panelSchema(organization).findOne({
panelName: widgetData.panel,
zoneId,
isArchive: false,
});
if (!addedExistingPanel) continue;
const existingWidget = await widgetSchema(organization).findOne({
panelID: addedExistingPanel._id,
widgetID: widgetData.id,
isArchive: false,
});
if (existingWidget) continue;
const newWidget = await widgetSchema(organization).create({
widgetID: widgetData.id,
elementType: widgetData.type,
widgetName: widgetData.widgetName || "Widget",
panelID: addedExistingPanel._id,
widgetside: widgetData.panel,
});
addedExistingPanel.widgets.push(newWidget._id);
await addedExistingPanel.save();
}
for (const floatData of existingTemplate.floatWidgets) {
const existingFloatWidget = await floatWidgetModel(
organization
).findOne({ floatWidgetID: floatData.id, isArchive: false, zoneId });
if (existingFloatWidget) continue;
await floatWidgetModel(organization).create({
className: floatData.className,
header: floatData.header,
floatWidgetID: floatData.id,
position: floatData.position,
per: floatData.per,
value: floatData.value,
zoneId,
});
}
const templateZoneDatas = {
template: { id: existingTemplate.templateID, name: existingTemplate.templateName, panelOrder: existingTemplate.panelOrder, widgets: existingTemplate.widgets, snapshot: existingTemplate.snapshot, floatingWidget: existingTemplate.floatWidgets },
zoneId: existingZone.zoneId, zoneName: existingZone.zoneName
}
return { success: true, message: "Template placed in Zone", data: templateZoneDatas, organization: organization }
} catch (error: any) {
return { success: false, message: error?.message || "Error occurred while template", error, organization: organization }
}
}
export const TemplateZoneDelete = async (data: any) => {
const { zoneId, templateID, organization } = data;
try {
const existingTemplate = await templateModel(organization).findOne({
templateID: templateID,
isArchive: false,
});
if (existingTemplate) {
const newTemplate = await templateModel(organization).updateOne(
{ templateID: templateID, isArchive: false },
{ $set: { isArchive: true } }
);
if (newTemplate) {
const TemplateDeleteData = existingTemplate.templateID
return { success: true, message: "Template deleted successfully", data: TemplateDeleteData, organization: organization }
}
}
} catch (error: any) {
return { success: false, message: error?.message || "Error occurred while template", error, organization: organization }
}
}

View File

@@ -1,4 +1,3 @@
import { title } from "process";
import panelSchema from "../../../shared/model/vizualization/panelmodel.ts";
import widgetSchema from "../../../shared/model/vizualization/widgemodel.ts";
import zoneSchema from "../../../shared/model/builder/lines/zone-Model.ts";
@@ -77,7 +76,6 @@ export const addWidget = async (data: any) => {
title: newWidget.widgetName,
}
const finaldata = { widgetData: widgetData, zoneId: existingZone.zoneId, zoneName: existingZone.zoneName }
// console.log('existingPanel: ', widgetData);
return { success: true, message: "Widget created successfully", data: finaldata, organization: organization }
}
}
@@ -89,7 +87,6 @@ export const addWidget = async (data: any) => {
}
export const Widgetdelete = async (data: any) => {
const { widgetID, zoneId, organization } = data
console.log('data: ', data);
try {
const existingZone = await zoneSchema(organization).findOne({
zoneId: zoneId,
@@ -114,7 +111,7 @@ export const Widgetdelete = async (data: any) => {
panelID: findWidget.panelID,
isArchive: false,
});
console.log('widgets: ', widgets);
// console.log('widgets: ', widgets);
// .sort({ widgetOrder: 1 });
// Reassign widgetOrder values

View File

@@ -65,10 +65,17 @@ export const EVENTS = {
floatUpdateRespones: "viz-float:response:updates",
deleteFloat: "v2:viz-float:delete",
floatDeleteRespones: "viz-float:response:delete",
duplicatefloat:"v2:viz-float:addDuplicate",
duplicatefloatUpdateRespones:"viz-float:response:addDuplicate",
//template
addTemplate:"v2:viz-template:add",
templateUpdateRespones:"viz-template:response:updates",
templateUpdateRespones:"viz-template:response:add",
addTemplateZone:"v2:viz-template:addToZone",
addTemplateZoneResponse:"viz-template:response:addTemplateZone",
deleteTemplate:"v2:viz-template:deleteTemplate",
TemplateDeleteResponse:"viz-template:response:delete",
//model-asset
setAssetModel: "v2:model-asset:add",

View File

@@ -9,8 +9,8 @@ import { activeUserOffline, activeUsers, } from '../services/users/user-controll
import { deleteZone, setZone } from '../services/lines/zone-controller.ts';
import { addPanel, panelDelete } from '../services/visualization/panel-Services.ts';
import { addWidget, Widgetdelete } from '../services/visualization/widget-Services.ts';
import { addfloat, deletefloat } from '../services/visualization/floatWidget-Service.ts';
import { addTemplate } from '../services/visualization/templateServices.ts';
import { addfloat, deletefloat, duplicatefloat } from '../services/visualization/floatWidget-Service.ts';
import { addTemplate, addTemplateZone, TemplateZoneDelete } from '../services/visualization/templateServices.ts';
import { deleteAssetModel, setAssetModel } from '../services/assets/asset-Controller.ts';
import { add3Dwidget } from '../services/visualization/3dWidget-Service.ts';
@@ -355,10 +355,7 @@ const lineHandleEvent =async (event: string, socket: Socket, data: any,io:any) =
const responseEvent = EVENTS.deletePointResponse
// console.log('responseEvent: ', responseEvent);
const organization = result?.organization
// console.log('organization: ', organization);
// const emitTarget = notifySender ? socket.in(organization) : socket.to(organization);
// console.log(`👀 Active sockets in room:`, namespace.adapter.rooms.get(organization));
// console.log('emitTarget: ', emitTarget);
if (organization) {
socket.to(organization).emit(responseEvent, {
success: result.success,
@@ -419,10 +416,6 @@ const userStatus =async (event: string, socket: Socket, data: any,io:any) => {
const responseEvent = EVENTS.userDisConnect
// console.log('responseEvent: ', responseEvent);
const organization = result?.organization
// console.log('organization: ', organization);
// const emitTarget = notifySender ? socket.in(organization) : socket.to(organization);
// console.log(`👀 Active sockets in room:`, namespace.adapter.rooms.get(organization));
// console.log('emitTarget: ', emitTarget);
if (organization) {
socket.to(organization).emit(responseEvent, {
success: result.success,
@@ -482,11 +475,7 @@ const zoneHandleEvent = async (event: string, socket: Socket, data: any, io: any
const responseEvent = EVENTS.ZoneDeleteRespones
// console.log('responseEvent: ', responseEvent);
const organization = result?.organization
// console.log('organization: ', organization);
// const emitTarget = notifySender ? socket.in(organization) : socket.to(organization);
// console.log(`👀 Active sockets in room:`, namespace.adapter.rooms.get(organization));
// console.log('emitTarget: ', emitTarget);
if (organization) {
if (organization) {
socket.to(organization).emit(responseEvent, {
success: result.success,
message: result.message,
@@ -542,10 +531,6 @@ const panelHandleEvent = async (event: string, socket: Socket, data: any, namesp
const responseEvent = EVENTS.PanelDeleteRespones
// console.log('responseEvent: ', responseEvent);
const organization = result?.organization
// console.log('organization: ', organization);
// const emitTarget = notifySender ? socket.in(organization) : socket.to(organization);
// console.log(`👀 Active sockets in room:`, namespace.adapter.rooms.get(organization));
// console.log('emitTarget: ', emitTarget);
if (organization) {
socket.to(organization).emit(responseEvent, {
success: result.success,
@@ -587,11 +572,7 @@ const widgetHandleEvent = async (event: string, socket: Socket, data: any, names
const responseEvent = EVENTS.widgetUpdateRespones
// console.log('responseEvent: ', responseEvent);
const organization = result?.organization
// console.log('organization: ', organization);
// const emitTarget = notifySender ? socket.in(organization) : socket.to(organization);
// console.log(`👀 Active sockets in room:`, namespace.adapter.rooms.get(organization));
// console.log('emitTarget: ', emitTarget);
if (organization) {
if (organization) {
socket.to(organization).emit(responseEvent, {
success: result.success,
message: result.message,
@@ -613,10 +594,7 @@ const widgetHandleEvent = async (event: string, socket: Socket, data: any, names
const responseEvent = EVENTS.widgetDeleteRespones
// console.log('responseEvent: ', responseEvent);
const organization = result?.organization
// console.log('organization: ', organization);
// const emitTarget = notifySender ? socket.in(organization) : socket.to(organization);
// console.log(`👀 Active sockets in room:`, namespace.adapter.rooms.get(organization));
// console.log('emitTarget: ', emitTarget);
if (organization) {
socket.to(organization).emit(responseEvent, {
success: result.success,
@@ -656,12 +634,8 @@ const floatHandleEvent = async (event: string, socket: Socket, data: any, namesp
const responseEvent = EVENTS.floatUpdateRespones
// console.log('responseEvent: ', responseEvent);
const organization = result?.organization
// console.log('organization: ', organization);
// const emitTarget = notifySender ? socket.in(organization) : socket.to(organization);
// console.log(`👀 Active sockets in room:`, namespace.adapter.rooms.get(organization));
// console.log('emitTarget: ', emitTarget);
if (organization) {
socket.emit(responseEvent, {
socket.to(organization).emit(responseEvent, {
success: result.success,
message: result.message,
data: result.data,
@@ -682,10 +656,6 @@ const floatHandleEvent = async (event: string, socket: Socket, data: any, namesp
const responseEvent = EVENTS.floatDeleteRespones
// console.log('responseEvent: ', responseEvent);
const organization = result?.organization
// console.log('organization: ', organization);
// const emitTarget = notifySender ? socket.in(organization) : socket.to(organization);
// console.log(`👀 Active sockets in room:`, namespace.adapter.rooms.get(organization));
// console.log('emitTarget: ', emitTarget);
if (organization) {
socket.to(organization).emit(responseEvent, {
success: result.success,
@@ -739,32 +709,72 @@ const templateHandleEvent = async (event: string, socket: Socket, data: any, nam
}
break
}
// case EVENTS.deleteWidget: {
// const result = await Widgetdelete(data)
// if (result) {
// // console.log('result?.success: ', result.organization);
// const responseEvent = EVENTS.widgetDeleteRespones
// // console.log('responseEvent: ', responseEvent);
// const organization = result?.organization
// // console.log('organization: ', organization);
// // const emitTarget = notifySender ? socket.in(organization) : socket.to(organization);
// // console.log(`👀 Active sockets in room:`, namespace.adapter.rooms.get(organization));
// // console.log('emitTarget: ', emitTarget);
// if (organization) {
// socket.emit(responseEvent, {
// success: result.success,
// message: result.message,
// data: result.data,
// error: result.error || null,
// socketId: socket.id,
// organization,
// });
// } else {
// console.warn(`Organization missing in response for event: ${event}`);
// }
// }
// break
// }
case EVENTS.addTemplateZone: {
const result = await addTemplateZone(data)
if (result) {
// console.log('result?.success: ', result.organization);
const responseEvent = EVENTS.addTemplateZoneResponse
// console.log('responseEvent: ', responseEvent
const organization = result?.organization
if (organization) {
socket.to(organization).emit(responseEvent, {
success: result.success,
message: result.message,
data: result.data,
error: result.error || null,
socketId: socket.id,
organization,
});
} else {
console.warn(`Organization missing in response for event: ${event}`);
}
}
break
}
case EVENTS.deleteTemplate: {
const result = await TemplateZoneDelete(data)
if (result) {
// console.log('result?.success: ', result.organization);
const responseEvent = EVENTS.TemplateDeleteResponse
// console.log('responseEvent: ', responseEvent);
const organization = result?.organization
if (organization) {
socket.to(organization).emit(responseEvent, {
success: result.success,
message: result.message,
data: result.data,
error: result.error || null,
socketId: socket.id,
organization,
});
} else {
console.warn(`Organization missing in response for event: ${event}`);
}
}
break
}
case EVENTS.duplicatefloat: {
const result = await duplicatefloat(data)
if (result) {
// console.log('result?.success: ', result.organization);
const responseEvent = EVENTS.duplicatefloatUpdateRespones
// console.log('responseEvent: ', responseEvent);
const organization = result?.organization
if (organization) {
socket.to(organization).emit(responseEvent, {
success: result.success,
message: result.message,
data: result.data,
error: result.error || null,
socketId: socket.id,
organization,
});
} else {
console.warn(`Organization missing in response for event: ${event}`);
}
}
break
}
default:
return;
@@ -803,7 +813,8 @@ const Widget3DHandleEvent = async (event: string, socket: Socket, data: any, nam
}
break
}
// case EVENTS.deleteWidget: {
// case EVENTS.deleteWidget: {
// const result = await Widgetdelete(data)
// if (result) {
// // console.log('result?.success: ', result.organization);
@@ -874,10 +885,6 @@ const modelAssetHandleEvent = async (event: string, socket: Socket, data: any, n
const responseEvent = EVENTS.assetDeleteRespones
// console.log('responseEvent: ', responseEvent);
const organization = result?.organization
// console.log('organization: ', organization);
// const emitTarget = notifySender ? socket.in(organization) : socket.to(organization);
// console.log(`👀 Active sockets in room:`, namespace.adapter.rooms.get(organization));
// console.log('emitTarget: ', emitTarget);
if (organization) {
socket.to(organization).emit(responseEvent, {
success: result.success,
@@ -1031,7 +1038,7 @@ export const initSocketServer = (httpServer: any) => {
// handleNamespace("visualization", namespaces.panel, panelHandleEvent);
// handleNamespace("widget", namespaces.visualization, widgetHandleEvent);
handleNamespace("Builder", namespaces.Builder, userStatus,modelAssetHandleEvent, cameraHandleEvent, EnvironmentHandleEvent, wallItemsHandleEvent, lineHandleEvent,zoneHandleEvent);
handleNamespace("Visualization", namespaces.visualization, panelHandleEvent, widgetHandleEvent, floatHandleEvent, templateHandleEvent);
handleNamespace("Visualization", namespaces.visualization, panelHandleEvent, widgetHandleEvent, floatHandleEvent, templateHandleEvent,Widget3DHandleEvent);
return io;
};