Controller and routing for the Vizualtion and builder
This commit is contained in:
@@ -53,11 +53,7 @@ export const Add3DWidget = async (data: IWidget3DAdd): Promise<IResult> => {
|
||||
projectId: projectId,
|
||||
});
|
||||
if (!existingZone) return { status: "Zone not found for the zoneId" };
|
||||
// return {
|
||||
// success: false,
|
||||
// message: "Zone not found for the zoneId",
|
||||
// organization: organization,
|
||||
// };
|
||||
|
||||
const existing3Dwidget = await widget3dModel(organization).findOne({
|
||||
widgetID: widget.id,
|
||||
isArchive: false,
|
||||
@@ -76,17 +72,7 @@ export const Add3DWidget = async (data: IWidget3DAdd): Promise<IResult> => {
|
||||
return {
|
||||
status: "3dwidget update successfully",
|
||||
};
|
||||
// return {
|
||||
// success: true,
|
||||
// message: "widget update successfully",
|
||||
// organization: organization,
|
||||
// };
|
||||
} else return { status: "3dWidget not updated" };
|
||||
// return {
|
||||
// success: false,
|
||||
// message: "Widget not updated",
|
||||
// organization: organization,
|
||||
// };
|
||||
} else {
|
||||
const newWidget3d = await widget3dModel(organization).create({
|
||||
type: widget.type,
|
||||
@@ -115,12 +101,6 @@ export const Add3DWidget = async (data: IWidget3DAdd): Promise<IResult> => {
|
||||
};
|
||||
}
|
||||
return { status: "Widget 3d not created" };
|
||||
// return {
|
||||
// success: true,
|
||||
// message: "Widget created successfully",
|
||||
// data: widgemodel3D_Datas,
|
||||
// organization: organization,
|
||||
// };
|
||||
}
|
||||
} catch (error: unknown) {
|
||||
if (error instanceof Error) {
|
||||
@@ -149,11 +129,7 @@ export const Update3Dwidget = async (data: IWidgetUpdate): Promise<IResult> => {
|
||||
return {
|
||||
status: "Zone not found",
|
||||
};
|
||||
// return {
|
||||
// success: false,
|
||||
// message: "Zone not found",
|
||||
// organization: organization,
|
||||
// };
|
||||
|
||||
const existing3Dwidget = await widget3dModel(organization).findOne({
|
||||
widgetID: id,
|
||||
zoneId: zoneId,
|
||||
@@ -183,21 +159,10 @@ export const Update3Dwidget = async (data: IWidgetUpdate): Promise<IResult> => {
|
||||
status: "Success",
|
||||
data: updateDatas,
|
||||
};
|
||||
// return {
|
||||
// success: true,
|
||||
// message: "widget update successfully",
|
||||
// data: updateDatas,
|
||||
// organization: organization,
|
||||
// };
|
||||
}
|
||||
return { status: "Widget not updated" };
|
||||
} else {
|
||||
return { status: "widget not found" };
|
||||
// return {
|
||||
// success: false,
|
||||
// message: "widget not found",
|
||||
// organization: organization,
|
||||
// };
|
||||
}
|
||||
} catch (error: unknown) {
|
||||
if (error instanceof Error) {
|
||||
@@ -227,11 +192,7 @@ export const Delete3Dwidget = async (
|
||||
return {
|
||||
status: "Zone not found",
|
||||
};
|
||||
// return {
|
||||
// success: false,
|
||||
// message: "Zone not found",
|
||||
// organization: organization,
|
||||
// };
|
||||
|
||||
const existing3Dwidget = await widget3dModel(organization).findOne({
|
||||
widgetID: id,
|
||||
isArchive: false,
|
||||
@@ -239,11 +200,6 @@ export const Delete3Dwidget = async (
|
||||
});
|
||||
if (!existing3Dwidget) {
|
||||
return { status: "3D widget not found for the ID" };
|
||||
// return {
|
||||
// success: false,
|
||||
// message: "3D widget not found for the ID",
|
||||
// organization: organization,
|
||||
// };
|
||||
}
|
||||
const updateWidget = await widget3dModel(organization).findOneAndUpdate(
|
||||
{
|
||||
@@ -263,12 +219,6 @@ export const Delete3Dwidget = async (
|
||||
status: "Success",
|
||||
data: delete_Datas,
|
||||
};
|
||||
// return {
|
||||
// success: true,
|
||||
// data: delete_Datas,
|
||||
// message: "3DWidget delete successfull",
|
||||
// organization: organization,
|
||||
// };
|
||||
}
|
||||
return { status: "3DWidget delete unsuccessfull" };
|
||||
} catch (error: unknown) {
|
||||
@@ -297,14 +247,12 @@ export const Get3Dwidget = async (data: I3dWidgetGet): Promise<IResult> => {
|
||||
return {
|
||||
status: "Zone not found",
|
||||
};
|
||||
// return res.send("Zone not found");
|
||||
const widgetData = await widget3dModel(organization).find({
|
||||
zoneId: zoneId,
|
||||
isArchive: false,
|
||||
});
|
||||
if (!widgetData || widgetData.length === 0) {
|
||||
return { status: "All 3Dwidgets" };
|
||||
// return res.json([]);
|
||||
}
|
||||
|
||||
const zonebasedWidget = widgetData.map((widget) => ({
|
||||
@@ -318,7 +266,6 @@ export const Get3Dwidget = async (data: I3dWidgetGet): Promise<IResult> => {
|
||||
rotation: widget?.rotation,
|
||||
}));
|
||||
return { status: "Success", data: zonebasedWidget };
|
||||
// return res.status(200).json(zonebasedWidget);
|
||||
} catch (error: unknown) {
|
||||
if (error instanceof Error) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user