New version API collaboration and tested for Project
This commit is contained in:
@@ -38,6 +38,11 @@ export const NewLineController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Success":
|
||||
res.status(201).json(result.data);
|
||||
break;
|
||||
@@ -81,6 +86,11 @@ export const UpdateLineController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Success":
|
||||
res.status(201).json(result.data);
|
||||
break;
|
||||
@@ -122,6 +132,11 @@ export const DeleteLineController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "line not found":
|
||||
res.status(404).json({
|
||||
message: "data not found",
|
||||
@@ -168,6 +183,11 @@ export const DeleteLayerController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "layer not found":
|
||||
res.status(404).json({
|
||||
message: "data not found",
|
||||
@@ -215,6 +235,11 @@ export const DeleteLinePointsController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Line not found":
|
||||
res.status(404).json({
|
||||
message: "data not found",
|
||||
@@ -260,6 +285,11 @@ export const GetLinesController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Success":
|
||||
res.status(200).json(result.data);
|
||||
break;
|
||||
|
||||
@@ -60,12 +60,12 @@ export const CreateAssetController = async (
|
||||
|
||||
switch (result.status) {
|
||||
case "User not found":
|
||||
res.status(200).json({
|
||||
res.status(404).json({
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(200).json({
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
|
||||
@@ -40,22 +40,22 @@ export const SetNewCamera = async (
|
||||
const result = await SetCamera(data);
|
||||
|
||||
switch (result.status) {
|
||||
case "User not found":
|
||||
res.status(404).json({
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
TrashDatas: [],
|
||||
});
|
||||
break;
|
||||
|
||||
case "Update Success":
|
||||
res.status(200).json({
|
||||
TrashDatas: result.data,
|
||||
});
|
||||
res.status(200).json(result.data);
|
||||
break;
|
||||
case "Success":
|
||||
res.status(200).json({
|
||||
TrashDatas: result.data,
|
||||
});
|
||||
res.status(200).json(result.data);
|
||||
break;
|
||||
default:
|
||||
res.status(500).json({
|
||||
@@ -90,16 +90,18 @@ export const CameraList = async (
|
||||
});
|
||||
|
||||
switch (result.status) {
|
||||
case "User not found":
|
||||
res.status(404).json({
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
TrashDatas: [],
|
||||
});
|
||||
break;
|
||||
case "Success":
|
||||
res.status(200).json({
|
||||
TrashDatas: result.data,
|
||||
});
|
||||
res.status(200).json(result.data);
|
||||
break;
|
||||
default:
|
||||
res.status(500).json({
|
||||
@@ -136,6 +138,11 @@ export const ActiveOnlineController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Success":
|
||||
res.status(200).json(result.data);
|
||||
break;
|
||||
|
||||
@@ -56,7 +56,14 @@ export const WallSetup = async (
|
||||
});
|
||||
switch (result.status) {
|
||||
case "User not found":
|
||||
res.status(404).json({ message: "User not found" });
|
||||
res.status(404).json({
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Updated successfully":
|
||||
res.status(200).json(result.data);
|
||||
@@ -96,7 +103,14 @@ export const WallGet = async (
|
||||
|
||||
switch (result.status) {
|
||||
case "User not found":
|
||||
res.status(404).json({ message: "User not found" });
|
||||
res.status(404).json({
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "wallitems not found":
|
||||
res.status(404).json({
|
||||
@@ -141,7 +155,14 @@ export const WallDelete = async (
|
||||
|
||||
switch (result.status) {
|
||||
case "User not found":
|
||||
res.status(404).json({ message: "User not found" });
|
||||
res.status(404).json({
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "model not found":
|
||||
res.status(404).json({
|
||||
|
||||
@@ -32,10 +32,15 @@ export const CreateZoneController = async (
|
||||
|
||||
switch (result.status) {
|
||||
case "User not found":
|
||||
res.status(200).json({
|
||||
res.status(404).json({
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "zone updated":
|
||||
res.status(200).json({
|
||||
message: "zone updated",
|
||||
@@ -87,6 +92,11 @@ export const DeleteZoneController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Invalid zone ID":
|
||||
res.status(404).json({
|
||||
message: "Zone not found for the UUID",
|
||||
@@ -134,6 +144,11 @@ export const GetZoneController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Invalid zone":
|
||||
res.status(404).json({
|
||||
message: "Zone not found for the UUID",
|
||||
@@ -179,6 +194,11 @@ export const VizZoneController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found for the UUID":
|
||||
res.status(404).json({
|
||||
message: "Zone not found for the UUID",
|
||||
@@ -226,6 +246,11 @@ export const ZoneDataController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found":
|
||||
res.status(404).json({
|
||||
message: "Zone not found",
|
||||
@@ -272,6 +297,11 @@ export const SingleZonePanelController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found for the UUID":
|
||||
res.status(404).json({
|
||||
message: "Zone not found for the UUID",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Request, Response } from "express";
|
||||
import { Response } from "express";
|
||||
import {
|
||||
RecentlyAdded,
|
||||
searchProject,
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { Request, Response } from "express";
|
||||
import { Response } from "express";
|
||||
import {
|
||||
createProject,
|
||||
DeleteProject,
|
||||
DuplicateProject,
|
||||
GetAllProjects,
|
||||
updateProject,
|
||||
viewProject,
|
||||
@@ -15,6 +16,7 @@ export const createProjectController = async (
|
||||
try {
|
||||
const { userId, organization } = req.user || {};
|
||||
const { projectUuid, thumbnail } = req.body;
|
||||
|
||||
if (!req.user || !req.user.userId || !req.user.organization) {
|
||||
res.status(401).json({ message: "Unauthorized" });
|
||||
return;
|
||||
@@ -105,17 +107,12 @@ export const RemoveProject = async (
|
||||
try {
|
||||
const { projectId } = req.params;
|
||||
// const { organization, userId } = req.body;
|
||||
const { organization, userId, role } = req.user || {};
|
||||
if (
|
||||
!req.user ||
|
||||
!req.user.userId ||
|
||||
!req.user.organization ||
|
||||
!req.user.role
|
||||
) {
|
||||
const { organization, userId } = req.user || {};
|
||||
if (!req.user || !req.user.userId || !req.user.organization) {
|
||||
res.status(401).json({ message: "Unauthorized" });
|
||||
return;
|
||||
}
|
||||
if (!projectId || !organization || !userId || !role) {
|
||||
if (!projectId || !organization || !userId) {
|
||||
res.status(400).json({
|
||||
message: "All fields are required",
|
||||
});
|
||||
@@ -125,7 +122,6 @@ export const RemoveProject = async (
|
||||
projectId,
|
||||
organization,
|
||||
userId,
|
||||
role,
|
||||
});
|
||||
switch (result?.status) {
|
||||
case "Project not found":
|
||||
@@ -267,3 +263,59 @@ export const ViewData = async (
|
||||
return;
|
||||
}
|
||||
};
|
||||
export const ProjectDuplicateController = async (
|
||||
req: AuthenticatedRequest,
|
||||
res: Response
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { userId, organization } = req.user || {};
|
||||
const { projectUuid, thumbnail, projectName } = req.body;
|
||||
|
||||
if (!req.user || !req.user.userId || !req.user.organization) {
|
||||
res.status(401).json({ message: "Unauthorized" });
|
||||
return;
|
||||
}
|
||||
if (!projectUuid || !thumbnail || !projectName) {
|
||||
res.status(400).json({
|
||||
message: "All fields are required",
|
||||
});
|
||||
return;
|
||||
}
|
||||
const result = await DuplicateProject({
|
||||
...req.body,
|
||||
userId,
|
||||
organization,
|
||||
});
|
||||
|
||||
switch (result.status) {
|
||||
case "project_exists":
|
||||
res.status(403).json({
|
||||
message: "Project already exists",
|
||||
});
|
||||
break;
|
||||
|
||||
case "user_not_found":
|
||||
res.status(404).json({
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
|
||||
case "Success":
|
||||
res.status(201).json({
|
||||
message: "Project Duplicated Successfully",
|
||||
projectId: result.project._id,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
res.status(500).json({
|
||||
message: "Internal server error",
|
||||
});
|
||||
break;
|
||||
}
|
||||
} catch (error) {
|
||||
res.status(500).json({
|
||||
message: "Unknown error",
|
||||
});
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { Request, Response } from "express";
|
||||
import { Response } from "express";
|
||||
import {
|
||||
TrashDatas,
|
||||
RestoreTrashData,
|
||||
TrashDelete,
|
||||
} from "../../../../shared/services/v1trash/v1trashservice.ts";
|
||||
import { AuthenticatedRequest } from "../../../../shared/utils/token.ts";
|
||||
|
||||
@@ -107,7 +108,7 @@ export const RestoreTrash = async (
|
||||
});
|
||||
}
|
||||
};
|
||||
export const DeleteTrash = async (
|
||||
export const DeleteTrashData = async (
|
||||
req: AuthenticatedRequest,
|
||||
res: Response
|
||||
): Promise<void> => {
|
||||
@@ -122,7 +123,7 @@ export const DeleteTrash = async (
|
||||
});
|
||||
return;
|
||||
}
|
||||
const result = await RestoreTrashData({
|
||||
const result = await TrashDelete({
|
||||
organization,
|
||||
projectId,
|
||||
role,
|
||||
@@ -140,14 +141,14 @@ export const DeleteTrash = async (
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Project Trash Delete unsuccessfull":
|
||||
case "Project Already Deleted":
|
||||
res.status(200).json({
|
||||
message: "Project Trash Delete unsuccessfull",
|
||||
message: "Project Already Deleted",
|
||||
});
|
||||
break;
|
||||
case "Trash Project Restored successfully":
|
||||
case "Trash Project Delete successfully":
|
||||
res.status(200).json({
|
||||
message: "Trash Project Restored successfully",
|
||||
message: "Trash Project Delete successfully",
|
||||
});
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -43,6 +43,11 @@ export const FloatAddController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found for the zoneId":
|
||||
res.status(404).json({
|
||||
message: "Zone not found for the zoneId",
|
||||
@@ -102,6 +107,11 @@ export const DeleteFloatController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found for the zoneId":
|
||||
res.status(404).json({
|
||||
message: "Zone not found for the zoneId",
|
||||
@@ -169,6 +179,11 @@ export const DuplicateFloatController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found for the zoneId":
|
||||
res.status(404).json({
|
||||
message: "Zone not found for the zoneId",
|
||||
@@ -232,6 +247,11 @@ export const GetFloatController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found":
|
||||
res.status(404).json({
|
||||
message: "Zone not found",
|
||||
|
||||
@@ -34,6 +34,11 @@ export const AddPanelController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found":
|
||||
res.status(404).json({
|
||||
message: "Zone not found",
|
||||
@@ -89,6 +94,11 @@ export const DeletePanelController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found":
|
||||
res.status(404).json({
|
||||
message: "Zone not found",
|
||||
@@ -143,6 +153,11 @@ export const ClearPanelController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found":
|
||||
res.status(404).json({
|
||||
message: "Zone not found",
|
||||
@@ -202,6 +217,11 @@ export const LockedPanelController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found":
|
||||
res.status(404).json({
|
||||
message: "Zone not found",
|
||||
|
||||
@@ -33,6 +33,11 @@ export const AddTemplateController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "TemplateID alreay exists":
|
||||
res.status(200).json({
|
||||
message: "TemplateID alreay exists",
|
||||
@@ -87,6 +92,11 @@ export const AddTemToZoneController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found":
|
||||
res.status(404).json({
|
||||
message: "Zone not found",
|
||||
@@ -141,6 +151,11 @@ export const TemplateDeleteController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Template not found":
|
||||
res.status(404).json({
|
||||
message: "Template not found",
|
||||
@@ -193,6 +208,11 @@ export const GetTemplateController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "All Datas":
|
||||
res.status(404).json([]);
|
||||
break;
|
||||
|
||||
@@ -34,6 +34,11 @@ export const AddWidgetController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found for the zoneId":
|
||||
res.status(404).json({
|
||||
message: "Zone not found",
|
||||
@@ -102,6 +107,11 @@ export const WidgetDeleteController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found for the zoneId":
|
||||
res.status(404).json({
|
||||
message: "Zone not found for the zoneId",
|
||||
@@ -169,6 +179,11 @@ export const WidgetUpdateController = async (
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found for the zoneId":
|
||||
res.status(404).json({
|
||||
message: "Zone not found for the zoneId",
|
||||
@@ -232,6 +247,11 @@ export const GetWidgetController = async (
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found for the zoneId":
|
||||
res.status(404).json({
|
||||
message: "Zone not found for the zoneId",
|
||||
|
||||
@@ -34,6 +34,11 @@ export const Add3dWidgetController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found for the zoneId":
|
||||
res.status(200).json({
|
||||
message: "Zone not found",
|
||||
@@ -108,6 +113,11 @@ export const Update3DwidgetController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found":
|
||||
res.status(404).json({
|
||||
message: "Zone not found",
|
||||
@@ -167,6 +177,11 @@ export const Delete3DwidgetController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found":
|
||||
res.status(404).json({
|
||||
message: "Zone not found",
|
||||
@@ -225,6 +240,11 @@ export const Get3DWidgetController = async (
|
||||
message: "User not found",
|
||||
});
|
||||
break;
|
||||
case "Project not found":
|
||||
res.status(404).json({
|
||||
message: "Project not found",
|
||||
});
|
||||
break;
|
||||
case "Zone not found":
|
||||
res.status(404).json({
|
||||
message: "Zone not found",
|
||||
|
||||
Reference in New Issue
Block a user