New version API collaboration and tested for Project
This commit is contained in:
@@ -1,11 +1,17 @@
|
|||||||
import * as express from "express";
|
import * as express from "express";
|
||||||
import { recentDataController, searchProjectController, searchTrashProjectController } from "../controller/home/homeControllers.ts";
|
import {
|
||||||
import { searchTrashProject } from "../../shared/services/home/homeService.ts";
|
recentDataController,
|
||||||
|
searchProjectController,
|
||||||
|
searchTrashProjectController,
|
||||||
|
} from "../controller/home/homeControllers.ts";
|
||||||
import { tutorialsDataController } from "../controller/home/tutorialControllers.ts";
|
import { tutorialsDataController } from "../controller/home/tutorialControllers.ts";
|
||||||
|
|
||||||
const homePageRouter = express.Router();
|
const homePageRouter = express.Router();
|
||||||
|
|
||||||
homePageRouter.get("/RecentlyViewed/:userId/:organization", recentDataController);
|
homePageRouter.get(
|
||||||
|
"/RecentlyViewed/:userId/:organization",
|
||||||
|
recentDataController
|
||||||
|
);
|
||||||
homePageRouter.get("/searchProjects", searchProjectController);
|
homePageRouter.get("/searchProjects", searchProjectController);
|
||||||
homePageRouter.get("/searchTrashProjects", searchTrashProjectController);
|
homePageRouter.get("/searchTrashProjects", searchTrashProjectController);
|
||||||
homePageRouter.get("/tutorials", tutorialsDataController);
|
homePageRouter.get("/tutorials", tutorialsDataController);
|
||||||
|
|||||||
@@ -38,6 +38,11 @@ export const NewLineController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Success":
|
case "Success":
|
||||||
res.status(201).json(result.data);
|
res.status(201).json(result.data);
|
||||||
break;
|
break;
|
||||||
@@ -81,6 +86,11 @@ export const UpdateLineController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Success":
|
case "Success":
|
||||||
res.status(201).json(result.data);
|
res.status(201).json(result.data);
|
||||||
break;
|
break;
|
||||||
@@ -122,6 +132,11 @@ export const DeleteLineController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "line not found":
|
case "line not found":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "data not found",
|
message: "data not found",
|
||||||
@@ -168,6 +183,11 @@ export const DeleteLayerController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "layer not found":
|
case "layer not found":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "data not found",
|
message: "data not found",
|
||||||
@@ -215,6 +235,11 @@ export const DeleteLinePointsController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Line not found":
|
case "Line not found":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "data not found",
|
message: "data not found",
|
||||||
@@ -260,6 +285,11 @@ export const GetLinesController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Success":
|
case "Success":
|
||||||
res.status(200).json(result.data);
|
res.status(200).json(result.data);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -60,12 +60,12 @@ export const CreateAssetController = async (
|
|||||||
|
|
||||||
switch (result.status) {
|
switch (result.status) {
|
||||||
case "User not found":
|
case "User not found":
|
||||||
res.status(200).json({
|
res.status(404).json({
|
||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "Project not found":
|
case "Project not found":
|
||||||
res.status(200).json({
|
res.status(404).json({
|
||||||
message: "Project not found",
|
message: "Project not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -40,22 +40,22 @@ export const SetNewCamera = async (
|
|||||||
const result = await SetCamera(data);
|
const result = await SetCamera(data);
|
||||||
|
|
||||||
switch (result.status) {
|
switch (result.status) {
|
||||||
|
case "User not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "User not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Project not found":
|
case "Project not found":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Project not found",
|
message: "Project not found",
|
||||||
TrashDatas: [],
|
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Update Success":
|
case "Update Success":
|
||||||
res.status(200).json({
|
res.status(200).json(result.data);
|
||||||
TrashDatas: result.data,
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
case "Success":
|
case "Success":
|
||||||
res.status(200).json({
|
res.status(200).json(result.data);
|
||||||
TrashDatas: result.data,
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
res.status(500).json({
|
res.status(500).json({
|
||||||
@@ -90,16 +90,18 @@ export const CameraList = async (
|
|||||||
});
|
});
|
||||||
|
|
||||||
switch (result.status) {
|
switch (result.status) {
|
||||||
|
case "User not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "User not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Project not found":
|
case "Project not found":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Project not found",
|
message: "Project not found",
|
||||||
TrashDatas: [],
|
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "Success":
|
case "Success":
|
||||||
res.status(200).json({
|
res.status(200).json(result.data);
|
||||||
TrashDatas: result.data,
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
res.status(500).json({
|
res.status(500).json({
|
||||||
@@ -136,6 +138,11 @@ export const ActiveOnlineController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Success":
|
case "Success":
|
||||||
res.status(200).json(result.data);
|
res.status(200).json(result.data);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -56,7 +56,14 @@ export const WallSetup = async (
|
|||||||
});
|
});
|
||||||
switch (result.status) {
|
switch (result.status) {
|
||||||
case "User not found":
|
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;
|
break;
|
||||||
case "Updated successfully":
|
case "Updated successfully":
|
||||||
res.status(200).json(result.data);
|
res.status(200).json(result.data);
|
||||||
@@ -96,7 +103,14 @@ export const WallGet = async (
|
|||||||
|
|
||||||
switch (result.status) {
|
switch (result.status) {
|
||||||
case "User not found":
|
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;
|
break;
|
||||||
case "wallitems not found":
|
case "wallitems not found":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
@@ -141,7 +155,14 @@ export const WallDelete = async (
|
|||||||
|
|
||||||
switch (result.status) {
|
switch (result.status) {
|
||||||
case "User not found":
|
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;
|
break;
|
||||||
case "model not found":
|
case "model not found":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
|
|||||||
@@ -32,10 +32,15 @@ export const CreateZoneController = async (
|
|||||||
|
|
||||||
switch (result.status) {
|
switch (result.status) {
|
||||||
case "User not found":
|
case "User not found":
|
||||||
res.status(200).json({
|
res.status(404).json({
|
||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "zone updated":
|
case "zone updated":
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
message: "zone updated",
|
message: "zone updated",
|
||||||
@@ -87,6 +92,11 @@ export const DeleteZoneController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Invalid zone ID":
|
case "Invalid zone ID":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Zone not found for the UUID",
|
message: "Zone not found for the UUID",
|
||||||
@@ -134,6 +144,11 @@ export const GetZoneController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Invalid zone":
|
case "Invalid zone":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Zone not found for the UUID",
|
message: "Zone not found for the UUID",
|
||||||
@@ -179,6 +194,11 @@ export const VizZoneController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Zone not found for the UUID":
|
case "Zone not found for the UUID":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Zone not found for the UUID",
|
message: "Zone not found for the UUID",
|
||||||
@@ -226,6 +246,11 @@ export const ZoneDataController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Zone not found":
|
case "Zone not found":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Zone not found",
|
message: "Zone not found",
|
||||||
@@ -272,6 +297,11 @@ export const SingleZonePanelController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Zone not found for the UUID":
|
case "Zone not found for the UUID":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Zone not found for the UUID",
|
message: "Zone not found for the UUID",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Request, Response } from "express";
|
import { Response } from "express";
|
||||||
import {
|
import {
|
||||||
RecentlyAdded,
|
RecentlyAdded,
|
||||||
searchProject,
|
searchProject,
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { Request, Response } from "express";
|
import { Response } from "express";
|
||||||
import {
|
import {
|
||||||
createProject,
|
createProject,
|
||||||
DeleteProject,
|
DeleteProject,
|
||||||
|
DuplicateProject,
|
||||||
GetAllProjects,
|
GetAllProjects,
|
||||||
updateProject,
|
updateProject,
|
||||||
viewProject,
|
viewProject,
|
||||||
@@ -15,6 +16,7 @@ export const createProjectController = async (
|
|||||||
try {
|
try {
|
||||||
const { userId, organization } = req.user || {};
|
const { userId, organization } = req.user || {};
|
||||||
const { projectUuid, thumbnail } = req.body;
|
const { projectUuid, thumbnail } = req.body;
|
||||||
|
|
||||||
if (!req.user || !req.user.userId || !req.user.organization) {
|
if (!req.user || !req.user.userId || !req.user.organization) {
|
||||||
res.status(401).json({ message: "Unauthorized" });
|
res.status(401).json({ message: "Unauthorized" });
|
||||||
return;
|
return;
|
||||||
@@ -105,17 +107,12 @@ export const RemoveProject = async (
|
|||||||
try {
|
try {
|
||||||
const { projectId } = req.params;
|
const { projectId } = req.params;
|
||||||
// const { organization, userId } = req.body;
|
// const { organization, userId } = req.body;
|
||||||
const { organization, userId, role } = req.user || {};
|
const { organization, userId } = req.user || {};
|
||||||
if (
|
if (!req.user || !req.user.userId || !req.user.organization) {
|
||||||
!req.user ||
|
|
||||||
!req.user.userId ||
|
|
||||||
!req.user.organization ||
|
|
||||||
!req.user.role
|
|
||||||
) {
|
|
||||||
res.status(401).json({ message: "Unauthorized" });
|
res.status(401).json({ message: "Unauthorized" });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!projectId || !organization || !userId || !role) {
|
if (!projectId || !organization || !userId) {
|
||||||
res.status(400).json({
|
res.status(400).json({
|
||||||
message: "All fields are required",
|
message: "All fields are required",
|
||||||
});
|
});
|
||||||
@@ -125,7 +122,6 @@ export const RemoveProject = async (
|
|||||||
projectId,
|
projectId,
|
||||||
organization,
|
organization,
|
||||||
userId,
|
userId,
|
||||||
role,
|
|
||||||
});
|
});
|
||||||
switch (result?.status) {
|
switch (result?.status) {
|
||||||
case "Project not found":
|
case "Project not found":
|
||||||
@@ -267,3 +263,59 @@ export const ViewData = async (
|
|||||||
return;
|
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 {
|
import {
|
||||||
TrashDatas,
|
TrashDatas,
|
||||||
RestoreTrashData,
|
RestoreTrashData,
|
||||||
|
TrashDelete,
|
||||||
} from "../../../../shared/services/v1trash/v1trashservice.ts";
|
} from "../../../../shared/services/v1trash/v1trashservice.ts";
|
||||||
import { AuthenticatedRequest } from "../../../../shared/utils/token.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,
|
req: AuthenticatedRequest,
|
||||||
res: Response
|
res: Response
|
||||||
): Promise<void> => {
|
): Promise<void> => {
|
||||||
@@ -122,7 +123,7 @@ export const DeleteTrash = async (
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const result = await RestoreTrashData({
|
const result = await TrashDelete({
|
||||||
organization,
|
organization,
|
||||||
projectId,
|
projectId,
|
||||||
role,
|
role,
|
||||||
@@ -140,14 +141,14 @@ export const DeleteTrash = async (
|
|||||||
message: "Project not found",
|
message: "Project not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "Project Trash Delete unsuccessfull":
|
case "Project Already Deleted":
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
message: "Project Trash Delete unsuccessfull",
|
message: "Project Already Deleted",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "Trash Project Restored successfully":
|
case "Trash Project Delete successfully":
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
message: "Trash Project Restored successfully",
|
message: "Trash Project Delete successfully",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -43,6 +43,11 @@ export const FloatAddController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Zone not found for the zoneId":
|
case "Zone not found for the zoneId":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Zone not found for the zoneId",
|
message: "Zone not found for the zoneId",
|
||||||
@@ -102,6 +107,11 @@ export const DeleteFloatController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Zone not found for the zoneId":
|
case "Zone not found for the zoneId":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Zone not found for the zoneId",
|
message: "Zone not found for the zoneId",
|
||||||
@@ -169,6 +179,11 @@ export const DuplicateFloatController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Zone not found for the zoneId":
|
case "Zone not found for the zoneId":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Zone not found for the zoneId",
|
message: "Zone not found for the zoneId",
|
||||||
@@ -232,6 +247,11 @@ export const GetFloatController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Zone not found":
|
case "Zone not found":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Zone not found",
|
message: "Zone not found",
|
||||||
|
|||||||
@@ -34,6 +34,11 @@ export const AddPanelController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Zone not found":
|
case "Zone not found":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Zone not found",
|
message: "Zone not found",
|
||||||
@@ -89,6 +94,11 @@ export const DeletePanelController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Zone not found":
|
case "Zone not found":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Zone not found",
|
message: "Zone not found",
|
||||||
@@ -143,6 +153,11 @@ export const ClearPanelController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Zone not found":
|
case "Zone not found":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Zone not found",
|
message: "Zone not found",
|
||||||
@@ -202,6 +217,11 @@ export const LockedPanelController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Zone not found":
|
case "Zone not found":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Zone not found",
|
message: "Zone not found",
|
||||||
|
|||||||
@@ -33,6 +33,11 @@ export const AddTemplateController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "TemplateID alreay exists":
|
case "TemplateID alreay exists":
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
message: "TemplateID alreay exists",
|
message: "TemplateID alreay exists",
|
||||||
@@ -87,6 +92,11 @@ export const AddTemToZoneController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Zone not found":
|
case "Zone not found":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Zone not found",
|
message: "Zone not found",
|
||||||
@@ -141,6 +151,11 @@ export const TemplateDeleteController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Template not found":
|
case "Template not found":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Template not found",
|
message: "Template not found",
|
||||||
@@ -193,6 +208,11 @@ export const GetTemplateController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "All Datas":
|
case "All Datas":
|
||||||
res.status(404).json([]);
|
res.status(404).json([]);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -34,6 +34,11 @@ export const AddWidgetController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Zone not found for the zoneId":
|
case "Zone not found for the zoneId":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Zone not found",
|
message: "Zone not found",
|
||||||
@@ -102,6 +107,11 @@ export const WidgetDeleteController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Zone not found for the zoneId":
|
case "Zone not found for the zoneId":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Zone not found for the zoneId",
|
message: "Zone not found for the zoneId",
|
||||||
@@ -169,6 +179,11 @@ export const WidgetUpdateController = async (
|
|||||||
message: "Project not found",
|
message: "Project not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Zone not found for the zoneId":
|
case "Zone not found for the zoneId":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Zone not found for the zoneId",
|
message: "Zone not found for the zoneId",
|
||||||
@@ -232,6 +247,11 @@ export const GetWidgetController = async (
|
|||||||
message: "Project not found",
|
message: "Project not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Zone not found for the zoneId":
|
case "Zone not found for the zoneId":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Zone not found for the zoneId",
|
message: "Zone not found for the zoneId",
|
||||||
|
|||||||
@@ -34,6 +34,11 @@ export const Add3dWidgetController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Zone not found for the zoneId":
|
case "Zone not found for the zoneId":
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
message: "Zone not found",
|
message: "Zone not found",
|
||||||
@@ -108,6 +113,11 @@ export const Update3DwidgetController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Zone not found":
|
case "Zone not found":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Zone not found",
|
message: "Zone not found",
|
||||||
@@ -167,6 +177,11 @@ export const Delete3DwidgetController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Zone not found":
|
case "Zone not found":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Zone not found",
|
message: "Zone not found",
|
||||||
@@ -225,6 +240,11 @@ export const Get3DWidgetController = async (
|
|||||||
message: "User not found",
|
message: "User not found",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "Project not found":
|
||||||
|
res.status(404).json({
|
||||||
|
message: "Project not found",
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "Zone not found":
|
case "Zone not found":
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
message: "Zone not found",
|
message: "Zone not found",
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import express from "express";
|
|||||||
import {
|
import {
|
||||||
createProjectController,
|
createProjectController,
|
||||||
GetProjects,
|
GetProjects,
|
||||||
|
ProjectDuplicateController,
|
||||||
RemoveProject,
|
RemoveProject,
|
||||||
updateProjectController,
|
updateProjectController,
|
||||||
ViewData,
|
ViewData,
|
||||||
@@ -12,7 +13,12 @@ import authorizedRoles from "../../../shared/middleware/rbacMiddleware.ts";
|
|||||||
const v1projectRouter = express.Router();
|
const v1projectRouter = express.Router();
|
||||||
|
|
||||||
// project
|
// project
|
||||||
v1projectRouter.post("/upsertProject", tokenValidator, createProjectController);
|
v1projectRouter.post("/NewProject", tokenValidator, createProjectController);
|
||||||
|
v1projectRouter.post(
|
||||||
|
"/project/Duplicate",
|
||||||
|
tokenValidator,
|
||||||
|
ProjectDuplicateController
|
||||||
|
);
|
||||||
v1projectRouter.get(
|
v1projectRouter.get(
|
||||||
"/Projects",
|
"/Projects",
|
||||||
tokenValidator,
|
tokenValidator,
|
||||||
@@ -20,14 +26,14 @@ v1projectRouter.get(
|
|||||||
GetProjects
|
GetProjects
|
||||||
);
|
);
|
||||||
v1projectRouter.patch(
|
v1projectRouter.patch(
|
||||||
"/Project/archive/:projectId",
|
"/Projects/Archive/:projectId",
|
||||||
tokenValidator,
|
tokenValidator,
|
||||||
// authorizedRoles("Admin", "User"),
|
// authorizedRoles("Admin", "User"),
|
||||||
RemoveProject
|
RemoveProject
|
||||||
);
|
);
|
||||||
|
|
||||||
v1projectRouter.patch(
|
v1projectRouter.patch(
|
||||||
"/Project/:projectId",
|
"/Projects/:projectId",
|
||||||
tokenValidator,
|
tokenValidator,
|
||||||
// authorizedRoles("Admin", "User"),
|
// authorizedRoles("Admin", "User"),
|
||||||
updateProjectController
|
updateProjectController
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import express from "express";
|
|||||||
import { tokenValidator } from "../../../shared/utils/token.ts";
|
import { tokenValidator } from "../../../shared/utils/token.ts";
|
||||||
import authorizedRoles from "../../../shared/middleware/rbacMiddleware.ts";
|
import authorizedRoles from "../../../shared/middleware/rbacMiddleware.ts";
|
||||||
import {
|
import {
|
||||||
DeleteTrash,
|
DeleteTrashData,
|
||||||
GetTrashList,
|
GetTrashList,
|
||||||
RestoreTrash,
|
RestoreTrash,
|
||||||
} from "../../V1/v1Controllers/trashController/v1trashController.ts";
|
} from "../../V1/v1Controllers/trashController/v1trashController.ts";
|
||||||
@@ -22,11 +22,10 @@ v1TrashRoutes.patch(
|
|||||||
// authorizedRoles("Admin", "User"),
|
// authorizedRoles("Admin", "User"),
|
||||||
RestoreTrash
|
RestoreTrash
|
||||||
);
|
);
|
||||||
|
|
||||||
v1TrashRoutes.patch(
|
v1TrashRoutes.patch(
|
||||||
"/Trash/Delete",
|
"/Trash/Delete",
|
||||||
tokenValidator,
|
tokenValidator,
|
||||||
// authorizedRoles("Admin", "User"),
|
// authorizedRoles("Admin", "User"),
|
||||||
DeleteTrash
|
DeleteTrashData
|
||||||
);
|
);
|
||||||
export default v1TrashRoutes;
|
export default v1TrashRoutes;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ export const existingUser = async (userId: string, organization: string) => {
|
|||||||
}
|
}
|
||||||
const userData = await AuthModel(organization).findOne({
|
const userData = await AuthModel(organization).findOne({
|
||||||
_id: userId,
|
_id: userId,
|
||||||
|
isArchive: false,
|
||||||
});
|
});
|
||||||
return userData;
|
return userData;
|
||||||
};
|
};
|
||||||
@@ -90,11 +91,11 @@ export const existingProjectById = async (
|
|||||||
};
|
};
|
||||||
export const existingProjectByIdWithoutUser = async (
|
export const existingProjectByIdWithoutUser = async (
|
||||||
projectId: string,
|
projectId: string,
|
||||||
organization: string,
|
organization: string
|
||||||
) => {
|
) => {
|
||||||
const projectData = await projectModel(organization).findOne({
|
const projectData = await projectModel(organization).findOne({
|
||||||
_id: projectId,
|
_id: projectId,
|
||||||
isArchive: false,
|
isArchive: false,
|
||||||
});
|
});
|
||||||
return projectData;
|
return projectData;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,18 +2,14 @@ import projectModel from "../../model/project/project-model.ts";
|
|||||||
import { existingUser } from "../helpers/v1projecthelperFns.ts";
|
import { existingUser } from "../helpers/v1projecthelperFns.ts";
|
||||||
interface IOrg {
|
interface IOrg {
|
||||||
organization: string;
|
organization: string;
|
||||||
userId: string;
|
|
||||||
}
|
}
|
||||||
interface IRestore {
|
interface IRestore {
|
||||||
projectId: string;
|
projectId: string;
|
||||||
organization: string;
|
organization: string;
|
||||||
userId: string;
|
|
||||||
}
|
}
|
||||||
export const TrashDatas = async (data: IOrg) => {
|
export const TrashDatas = async (data: IOrg) => {
|
||||||
try {
|
try {
|
||||||
const { organization, userId } = data;
|
const { organization } = data;
|
||||||
const UserExists = await existingUser(userId, organization);
|
|
||||||
if (!UserExists) return { status: "User not found" };
|
|
||||||
const TrashLists = await projectModel(organization).find({
|
const TrashLists = await projectModel(organization).find({
|
||||||
isArchive: true,
|
isArchive: true,
|
||||||
isDeleted: false,
|
isDeleted: false,
|
||||||
@@ -51,9 +47,7 @@ export const TrashDatas = async (data: IOrg) => {
|
|||||||
};
|
};
|
||||||
export const RestoreTrashData = async (data: IRestore) => {
|
export const RestoreTrashData = async (data: IRestore) => {
|
||||||
try {
|
try {
|
||||||
const { projectId, organization, userId } = data;
|
const { projectId, organization } = data;
|
||||||
const UserExists = await existingUser(userId, organization);
|
|
||||||
if (!UserExists) return { status: "User not found" };
|
|
||||||
const findProject = await projectModel(organization).findOne({
|
const findProject = await projectModel(organization).findOne({
|
||||||
_id: projectId,
|
_id: projectId,
|
||||||
isArchive: true,
|
isArchive: true,
|
||||||
@@ -70,25 +64,4 @@ export const RestoreTrashData = async (data: IRestore) => {
|
|||||||
return { status: error };
|
return { status: error };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
export const TrashDelete = async (data: IRestore) => {
|
|
||||||
try {
|
|
||||||
const { projectId, organization, userId } = data;
|
|
||||||
const UserExists = await existingUser(userId, organization);
|
|
||||||
if (!UserExists) return { status: "User not found" };
|
|
||||||
const findProject = await projectModel(organization).findOne({
|
|
||||||
_id: projectId,
|
|
||||||
isArchive: true,
|
|
||||||
});
|
|
||||||
if (!findProject) return { status: "Project not found" };
|
|
||||||
const DeleteTrashData = await projectModel(organization).findOneAndUpdate(
|
|
||||||
{ _id: projectId, isArchive: true },
|
|
||||||
{ isDelete: true },
|
|
||||||
{ new: true }
|
|
||||||
);
|
|
||||||
if (!DeleteTrashData)
|
|
||||||
return { status: "Project Trash Delete unsuccessfull" };
|
|
||||||
return { status: "Trash Project Restored successfully" };
|
|
||||||
} catch (error) {
|
|
||||||
return { status: error };
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -16,6 +16,14 @@ interface CreateProjectInput {
|
|||||||
sharedUsers?: string[];
|
sharedUsers?: string[];
|
||||||
organization: string;
|
organization: string;
|
||||||
}
|
}
|
||||||
|
interface IProjectDuplicate {
|
||||||
|
projectName: string;
|
||||||
|
projectUuid: string;
|
||||||
|
userId: string; // user ID
|
||||||
|
thumbnail?: string;
|
||||||
|
sharedUsers?: string[];
|
||||||
|
organization: string;
|
||||||
|
}
|
||||||
interface updateProjectInput {
|
interface updateProjectInput {
|
||||||
projectName: string;
|
projectName: string;
|
||||||
projectId: string;
|
projectId: string;
|
||||||
@@ -30,6 +38,11 @@ interface GetProjectsInterface {
|
|||||||
organization: string;
|
organization: string;
|
||||||
role: string;
|
role: string;
|
||||||
}
|
}
|
||||||
|
interface ProjectDelInterface {
|
||||||
|
projectId: string;
|
||||||
|
userId: string;
|
||||||
|
organization: string;
|
||||||
|
}
|
||||||
interface ProjectInterface {
|
interface ProjectInterface {
|
||||||
projectId: string;
|
projectId: string;
|
||||||
userId: string;
|
userId: string;
|
||||||
@@ -44,6 +57,7 @@ export const createProject = async (data: CreateProjectInput) => {
|
|||||||
try {
|
try {
|
||||||
const { thumbnail, sharedUsers, projectUuid, userId, organization } = data;
|
const { thumbnail, sharedUsers, projectUuid, userId, organization } = data;
|
||||||
const userExisting = await existingUser(userId, organization);
|
const userExisting = await existingUser(userId, organization);
|
||||||
|
console.log("userExisting: ", userExisting);
|
||||||
if (!userExisting) {
|
if (!userExisting) {
|
||||||
return {
|
return {
|
||||||
status: "user_not_found",
|
status: "user_not_found",
|
||||||
@@ -115,16 +129,18 @@ export const GetAllProjects = async (data: GetProjectsInterface) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DeleteProject = async (data: ProjectInterface) => {
|
export const DeleteProject = async (data: ProjectDelInterface) => {
|
||||||
try {
|
try {
|
||||||
const { projectId, organization, userId, role } = data;
|
const { projectId, organization, userId } = data;
|
||||||
const ExistingUser = await existingUser(userId, organization);
|
const ExistingUser = await existingUser(userId, organization);
|
||||||
if (!ExistingUser) return { status: "User not found" };
|
if (!ExistingUser) return { status: "User not found" };
|
||||||
|
|
||||||
let filter = { _id: projectId, isArchive: false } as RoleFilter;
|
let filter = { _id: projectId, isArchive: false } as RoleFilter;
|
||||||
// if (role === "User") {
|
// if (role === "User") {
|
||||||
// filter.createdBy = userId;
|
// filter.createdBy = userId;
|
||||||
// }
|
// }
|
||||||
const existingProject = await projectModel(organization).findOne(filter);
|
const existingProject = await projectModel(organization).findOne(filter);
|
||||||
|
console.log("existingProject: ", existingProject);
|
||||||
if (!existingProject) return { status: "Project not found" };
|
if (!existingProject) return { status: "Project not found" };
|
||||||
const updateProject = await projectModel(organization).findOneAndUpdate(
|
const updateProject = await projectModel(organization).findOneAndUpdate(
|
||||||
filter,
|
filter,
|
||||||
@@ -162,6 +178,63 @@ export const updateProject = async (data: updateProjectInput) => {
|
|||||||
return { status: error };
|
return { status: error };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const DuplicateProject = async (data: IProjectDuplicate) => {
|
||||||
|
try {
|
||||||
|
const {
|
||||||
|
thumbnail,
|
||||||
|
sharedUsers,
|
||||||
|
projectUuid,
|
||||||
|
userId,
|
||||||
|
organization,
|
||||||
|
projectName,
|
||||||
|
} = data;
|
||||||
|
const userExisting = await existingUser(userId, organization);
|
||||||
|
if (!userExisting) {
|
||||||
|
return {
|
||||||
|
status: "user_not_found",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const projectExisting = await existingProject(
|
||||||
|
projectUuid,
|
||||||
|
organization,
|
||||||
|
userId
|
||||||
|
);
|
||||||
|
|
||||||
|
if (projectExisting) {
|
||||||
|
return {
|
||||||
|
status: "project_exists",
|
||||||
|
project: projectExisting,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const project = await projectModel(organization).create({
|
||||||
|
projectName: projectName,
|
||||||
|
projectUuid: projectUuid,
|
||||||
|
createdBy: userId,
|
||||||
|
thumbnail: thumbnail,
|
||||||
|
sharedUsers: sharedUsers || [],
|
||||||
|
isArchive: false,
|
||||||
|
});
|
||||||
|
const versionData = await previousVersion(project._id, organization);
|
||||||
|
if (!versionData || versionData.length === 0) {
|
||||||
|
const newVersion = await versionModel(organization).create({
|
||||||
|
projectId: project._id,
|
||||||
|
createdBy: userId,
|
||||||
|
version: 0.0,
|
||||||
|
});
|
||||||
|
await projectModel(organization).findByIdAndUpdate(
|
||||||
|
{ _id: project._id, isArchive: false },
|
||||||
|
{ total_versions: `v-${newVersion.version.toFixed(2)}` }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
status: "Success",
|
||||||
|
project: project,
|
||||||
|
};
|
||||||
|
} catch (error: unknown) {
|
||||||
|
return { status: error };
|
||||||
|
}
|
||||||
|
};
|
||||||
const maxLength: number = 6;
|
const maxLength: number = 6;
|
||||||
export const viewProject = async (data: ProjectInterface) => {
|
export const viewProject = async (data: ProjectInterface) => {
|
||||||
try {
|
try {
|
||||||
@@ -193,8 +266,8 @@ export const viewProject = async (data: ProjectInterface) => {
|
|||||||
newArr.pop();
|
newArr.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await UsersDataModel(organization).updateOne(
|
const datas = await UsersDataModel(organization).findOneAndUpdate(
|
||||||
{ _id: userId },
|
{ userId: userId, isArchive: false },
|
||||||
{ recentlyViewed: newArr },
|
{ recentlyViewed: newArr },
|
||||||
{ new: true }
|
{ new: true }
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import projectModel from "../../V1Models/Project/project-model.ts";
|
import projectModel from "../../V1Models/Project/project-model.ts";
|
||||||
import userModel from "../../model/user-Model.ts";
|
|
||||||
import UsersDataModel from "../../V1Models/Auth/user.ts";
|
import UsersDataModel from "../../V1Models/Auth/user.ts";
|
||||||
import { existingUser } from "../helpers/ProjecthelperFn.ts";
|
import { existingUser } from "../helpers/v1projecthelperFns.ts";
|
||||||
|
|
||||||
interface IRecentData {
|
interface IRecentData {
|
||||||
organization: string;
|
organization: string;
|
||||||
@@ -29,7 +28,6 @@ export const RecentlyAdded = async (data: IRecentData) => {
|
|||||||
try {
|
try {
|
||||||
const { userId, organization, role } = data;
|
const { userId, organization, role } = data;
|
||||||
const userExisting = await existingUser(userId, organization);
|
const userExisting = await existingUser(userId, organization);
|
||||||
console.log('userExisting: ', userExisting);
|
|
||||||
if (!userExisting) return { status: "User not found" };
|
if (!userExisting) return { status: "User not found" };
|
||||||
const userRecentData = await UsersDataModel(organization)
|
const userRecentData = await UsersDataModel(organization)
|
||||||
.findOne({ userId: userId, isArchive: false })
|
.findOne({ userId: userId, isArchive: false })
|
||||||
@@ -43,16 +41,19 @@ export const RecentlyAdded = async (data: IRecentData) => {
|
|||||||
// filter.createdBy = userId;
|
// filter.createdBy = userId;
|
||||||
// }
|
// }
|
||||||
const populatedProjects = userRecentData.recentlyViewed as IProject[];
|
const populatedProjects = userRecentData.recentlyViewed as IProject[];
|
||||||
|
console.log("populatedProjects: ", populatedProjects);
|
||||||
const RecentDatas = await Promise.all(
|
const RecentDatas = await Promise.all(
|
||||||
populatedProjects.map(async (project) => {
|
populatedProjects.map(async (project) => {
|
||||||
const projectExisting = await projectModel(organization)
|
const projectExisting = await projectModel(organization)
|
||||||
.findOne(filter)
|
.findOne({ _id: project._id, isArchive: false })
|
||||||
.select("_id projectName createdBy thumbnail createdAt isViewed");
|
.select("_id projectName createdBy thumbnail createdAt isViewed");
|
||||||
return projectExisting;
|
return projectExisting;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
console.log("RecentDatas: ", RecentDatas);
|
||||||
|
|
||||||
const filteredProjects = RecentDatas.filter(Boolean);
|
const filteredProjects = RecentDatas.filter(Boolean);
|
||||||
|
console.log("filteredProjects: ", filteredProjects);
|
||||||
return { status: "Success", data: filteredProjects };
|
return { status: "Success", data: filteredProjects };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return { status: error };
|
return { status: error };
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import projectModel from "../../V1Models/Project/project-model.ts";
|
import projectModel from "../../V1Models/Project/project-model.ts";
|
||||||
|
import { existingUser } from "../helpers/v1projecthelperFns.ts";
|
||||||
interface IOrg {
|
interface IOrg {
|
||||||
organization: string;
|
organization: string;
|
||||||
role: string;
|
role: string;
|
||||||
@@ -21,6 +22,8 @@ export const TrashDatas = async (data: IOrg) => {
|
|||||||
// if (role === "User") {
|
// if (role === "User") {
|
||||||
// filter.createdBy = userId;
|
// filter.createdBy = userId;
|
||||||
// }
|
// }
|
||||||
|
const UserExists = await existingUser(userId, organization);
|
||||||
|
if (!UserExists) return { status: "User not found" };
|
||||||
const TrashLists = await projectModel(organization).find(filter);
|
const TrashLists = await projectModel(organization).find(filter);
|
||||||
if (!TrashLists) return { staus: "Trash is Empty" };
|
if (!TrashLists) return { staus: "Trash is Empty" };
|
||||||
const TrashDocs: any[] = [];
|
const TrashDocs: any[] = [];
|
||||||
@@ -56,6 +59,8 @@ export const TrashDatas = async (data: IOrg) => {
|
|||||||
export const RestoreTrashData = async (data: IRestore) => {
|
export const RestoreTrashData = async (data: IRestore) => {
|
||||||
try {
|
try {
|
||||||
const { projectId, organization, role, userId } = data;
|
const { projectId, organization, role, userId } = data;
|
||||||
|
const UserExists = await existingUser(userId, organization);
|
||||||
|
if (!UserExists) return { status: "User not found" };
|
||||||
let filter = { isArchive: true, _id: projectId } as RoleFilter;
|
let filter = { isArchive: true, _id: projectId } as RoleFilter;
|
||||||
// if (role === "User") {
|
// if (role === "User") {
|
||||||
// filter.createdBy = userId;
|
// filter.createdBy = userId;
|
||||||
@@ -73,3 +78,24 @@ export const RestoreTrashData = async (data: IRestore) => {
|
|||||||
return { status: error };
|
return { status: error };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
export const TrashDelete = async (data: IRestore) => {
|
||||||
|
try {
|
||||||
|
const { projectId, organization, userId } = data;
|
||||||
|
const UserExists = await existingUser(userId, organization);
|
||||||
|
if (!UserExists) return { status: "User not found" };
|
||||||
|
const findProject = await projectModel(organization).findOne({
|
||||||
|
_id: projectId,
|
||||||
|
isArchive: true,
|
||||||
|
});
|
||||||
|
if (!findProject) return { status: "Project not found" };
|
||||||
|
const DeleteTrashData = await projectModel(organization).findOneAndUpdate(
|
||||||
|
{ _id: projectId, isArchive: true, isDeleted: false },
|
||||||
|
{ isDeleted: true },
|
||||||
|
{ new: true }
|
||||||
|
);
|
||||||
|
if (!DeleteTrashData) return { status: "Project Already Deleted" };
|
||||||
|
return { status: "Trash Project Delete successfully" };
|
||||||
|
} catch (error) {
|
||||||
|
return { status: error };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import floatWidgetModel from "../../V1Models/Vizualization/floatWidget.ts";
|
import floatWidgetModel from "../../V1Models/Vizualization/floatWidget.ts";
|
||||||
import zoneModel from "../../V1Models/Builder/zoneModel.ts";
|
import zoneModel from "../../V1Models/Builder/zoneModel.ts";
|
||||||
import { existingUser } from "../helpers/v1projecthelperFns.ts";
|
import {
|
||||||
|
existingProjectById,
|
||||||
|
existingUser,
|
||||||
|
} from "../helpers/v1projecthelperFns.ts";
|
||||||
|
|
||||||
interface IResult {
|
interface IResult {
|
||||||
status: string;
|
status: string;
|
||||||
@@ -75,6 +78,12 @@ export const AddFloat = async (data: IAddFloatData): Promise<IResult> => {
|
|||||||
const { organization, widget, zoneId, index, projectId, userId } = data;
|
const { organization, widget, zoneId, index, projectId, userId } = data;
|
||||||
const UserExists = await existingUser(userId, organization);
|
const UserExists = await existingUser(userId, organization);
|
||||||
if (!UserExists) return { status: "User not found" };
|
if (!UserExists) return { status: "User not found" };
|
||||||
|
const LivingProject = await existingProjectById(
|
||||||
|
projectId,
|
||||||
|
organization,
|
||||||
|
userId
|
||||||
|
);
|
||||||
|
if (!LivingProject) return { status: "Project not found" };
|
||||||
const existingZone = await zoneModel(organization).findOne({
|
const existingZone = await zoneModel(organization).findOne({
|
||||||
zoneId: zoneId,
|
zoneId: zoneId,
|
||||||
isArchive: false,
|
isArchive: false,
|
||||||
@@ -163,6 +172,12 @@ export const DelFloat = async (data: IDelFloat): Promise<IResult> => {
|
|||||||
const { organization, floatWidgetID, zoneId, projectId, userId } = data;
|
const { organization, floatWidgetID, zoneId, projectId, userId } = data;
|
||||||
const UserExists = await existingUser(userId, organization);
|
const UserExists = await existingUser(userId, organization);
|
||||||
if (!UserExists) return { status: "User not found" };
|
if (!UserExists) return { status: "User not found" };
|
||||||
|
const LivingProject = await existingProjectById(
|
||||||
|
projectId,
|
||||||
|
organization,
|
||||||
|
userId
|
||||||
|
);
|
||||||
|
if (!LivingProject) return { status: "Project not found" };
|
||||||
const existingZone = await zoneModel(organization).findOne({
|
const existingZone = await zoneModel(organization).findOne({
|
||||||
zoneId: zoneId,
|
zoneId: zoneId,
|
||||||
isArchive: false,
|
isArchive: false,
|
||||||
@@ -210,6 +225,12 @@ export const DuplicateFloat = async (
|
|||||||
const { organization, widget, zoneId, index, projectId, userId } = data;
|
const { organization, widget, zoneId, index, projectId, userId } = data;
|
||||||
const UserExists = await existingUser(userId, organization);
|
const UserExists = await existingUser(userId, organization);
|
||||||
if (!UserExists) return { status: "User not found" };
|
if (!UserExists) return { status: "User not found" };
|
||||||
|
const LivingProject = await existingProjectById(
|
||||||
|
projectId,
|
||||||
|
organization,
|
||||||
|
userId
|
||||||
|
);
|
||||||
|
if (!LivingProject) return { status: "Project not found" };
|
||||||
const existingZone = await zoneModel(organization).findOne({
|
const existingZone = await zoneModel(organization).findOne({
|
||||||
zoneId: zoneId,
|
zoneId: zoneId,
|
||||||
isArchive: false,
|
isArchive: false,
|
||||||
@@ -312,6 +333,12 @@ export const GetFloatWidget = async (data: IGetZoneFloat): Promise<IResult> => {
|
|||||||
const { organization, zoneId, projectId, userId } = data;
|
const { organization, zoneId, projectId, userId } = data;
|
||||||
const UserExists = await existingUser(userId, organization);
|
const UserExists = await existingUser(userId, organization);
|
||||||
if (!UserExists) return { status: "User not found" };
|
if (!UserExists) return { status: "User not found" };
|
||||||
|
const LivingProject = await existingProjectById(
|
||||||
|
projectId,
|
||||||
|
organization,
|
||||||
|
userId
|
||||||
|
);
|
||||||
|
if (!LivingProject) return { status: "Project not found" };
|
||||||
const existingZone = await zoneModel(organization).findOne({
|
const existingZone = await zoneModel(organization).findOne({
|
||||||
zoneId: zoneId,
|
zoneId: zoneId,
|
||||||
isArchive: false,
|
isArchive: false,
|
||||||
@@ -361,6 +388,7 @@ export const SingleFloatWidget = async (
|
|||||||
const { organization, floatWidgetID, userId } = data;
|
const { organization, floatWidgetID, userId } = data;
|
||||||
const UserExists = await existingUser(userId, organization);
|
const UserExists = await existingUser(userId, organization);
|
||||||
if (!UserExists) return { status: "User not found" };
|
if (!UserExists) return { status: "User not found" };
|
||||||
|
|
||||||
const widgetData = await floatWidgetModel(organization)
|
const widgetData = await floatWidgetModel(organization)
|
||||||
.findOne({
|
.findOne({
|
||||||
floatWidgetID: floatWidgetID,
|
floatWidgetID: floatWidgetID,
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
import panelModel from "../../V1Models/Vizualization/panelmodel.ts";
|
import panelModel from "../../V1Models/Vizualization/panelmodel.ts";
|
||||||
import zoneModel from "../../V1Models/Builder/zoneModel.ts";
|
import zoneModel from "../../V1Models/Builder/zoneModel.ts";
|
||||||
import widgetModel from "../../V1Models/Vizualization/widgemodel.ts";
|
import widgetModel from "../../V1Models/Vizualization/widgemodel.ts";
|
||||||
import { existingUser } from "../helpers/v1projecthelperFns.ts";
|
import {
|
||||||
|
existingProjectById,
|
||||||
|
existingUser,
|
||||||
|
} from "../helpers/v1projecthelperFns.ts";
|
||||||
interface IResult {
|
interface IResult {
|
||||||
status: string;
|
status: string;
|
||||||
data?: object;
|
data?: object;
|
||||||
@@ -32,6 +35,12 @@ export const AddPanel = async (data: IAddPanel): Promise<IResult> => {
|
|||||||
const { organization, zoneId, panelOrder, userId, projectId } = data;
|
const { organization, zoneId, panelOrder, userId, projectId } = data;
|
||||||
const UserExists = await existingUser(userId, organization);
|
const UserExists = await existingUser(userId, organization);
|
||||||
if (!UserExists) return { status: "User not found" };
|
if (!UserExists) return { status: "User not found" };
|
||||||
|
const LivingProject = await existingProjectById(
|
||||||
|
projectId,
|
||||||
|
organization,
|
||||||
|
userId
|
||||||
|
);
|
||||||
|
if (!LivingProject) return { status: "Project not found" };
|
||||||
const existingZone = await zoneModel(organization).findOne({
|
const existingZone = await zoneModel(organization).findOne({
|
||||||
zoneId: zoneId,
|
zoneId: zoneId,
|
||||||
isArchive: false,
|
isArchive: false,
|
||||||
@@ -97,6 +106,12 @@ export const DelPanel = async (data: IPanel): Promise<IResult> => {
|
|||||||
const { organization, zoneId, panelName, userId, projectId } = data;
|
const { organization, zoneId, panelName, userId, projectId } = data;
|
||||||
const UserExists = await existingUser(userId, organization);
|
const UserExists = await existingUser(userId, organization);
|
||||||
if (!UserExists) return { status: "User not found" };
|
if (!UserExists) return { status: "User not found" };
|
||||||
|
const LivingProject = await existingProjectById(
|
||||||
|
projectId,
|
||||||
|
organization,
|
||||||
|
userId
|
||||||
|
);
|
||||||
|
if (!LivingProject) return { status: "Project not found" };
|
||||||
const existingZone = await zoneModel(organization).findOne({
|
const existingZone = await zoneModel(organization).findOne({
|
||||||
zoneId: zoneId,
|
zoneId: zoneId,
|
||||||
isArchive: false,
|
isArchive: false,
|
||||||
@@ -156,6 +171,12 @@ export const ClearPanel = async (data: IPanel): Promise<IResult> => {
|
|||||||
const { organization, zoneId, panelName, userId, projectId } = data;
|
const { organization, zoneId, panelName, userId, projectId } = data;
|
||||||
const UserExists = await existingUser(userId, organization);
|
const UserExists = await existingUser(userId, organization);
|
||||||
if (!UserExists) return { status: "User not found" };
|
if (!UserExists) return { status: "User not found" };
|
||||||
|
const LivingProject = await existingProjectById(
|
||||||
|
projectId,
|
||||||
|
organization,
|
||||||
|
userId
|
||||||
|
);
|
||||||
|
if (!LivingProject) return { status: "Project not found" };
|
||||||
const existingZone = await zoneModel(organization).findOne({
|
const existingZone = await zoneModel(organization).findOne({
|
||||||
zoneId: zoneId,
|
zoneId: zoneId,
|
||||||
isArchive: false,
|
isArchive: false,
|
||||||
@@ -219,6 +240,12 @@ export const LockedPanel = async (data: ILockedPanel): Promise<IResult> => {
|
|||||||
const { organization, zoneId, lockedPanel, userId, projectId } = data;
|
const { organization, zoneId, lockedPanel, userId, projectId } = data;
|
||||||
const UserExists = await existingUser(userId, organization);
|
const UserExists = await existingUser(userId, organization);
|
||||||
if (!UserExists) return { status: "User not found" };
|
if (!UserExists) return { status: "User not found" };
|
||||||
|
const LivingProject = await existingProjectById(
|
||||||
|
projectId,
|
||||||
|
organization,
|
||||||
|
userId
|
||||||
|
);
|
||||||
|
if (!LivingProject) return { status: "Project not found" };
|
||||||
const existingZone = await zoneModel(organization).findOne({
|
const existingZone = await zoneModel(organization).findOne({
|
||||||
zoneId: zoneId,
|
zoneId: zoneId,
|
||||||
isArchive: false,
|
isArchive: false,
|
||||||
@@ -267,6 +294,8 @@ const getZoneAndPanelData = async (
|
|||||||
projectId: string
|
projectId: string
|
||||||
) => {
|
) => {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
const existingZone = await zoneModel(organization)
|
const existingZone = await zoneModel(organization)
|
||||||
.findOne({
|
.findOne({
|
||||||
zoneId: zoneId,
|
zoneId: zoneId,
|
||||||
|
|||||||
@@ -3,7 +3,10 @@ import panelModel from "../../V1Models/Vizualization/panelmodel.ts";
|
|||||||
import zoneModel from "../../V1Models/Builder/zoneModel.ts";
|
import zoneModel from "../../V1Models/Builder/zoneModel.ts";
|
||||||
import widgetModel from "../../V1Models/Vizualization/widgemodel.ts";
|
import widgetModel from "../../V1Models/Vizualization/widgemodel.ts";
|
||||||
import floatWidgetModel from "../../V1Models/Vizualization/floatWidget.ts";
|
import floatWidgetModel from "../../V1Models/Vizualization/floatWidget.ts";
|
||||||
import { existingUser } from "../helpers/v1projecthelperFns.ts";
|
import {
|
||||||
|
existingProjectById,
|
||||||
|
existingUser,
|
||||||
|
} from "../helpers/v1projecthelperFns.ts";
|
||||||
interface IResult {
|
interface IResult {
|
||||||
status: string;
|
status: string;
|
||||||
data?: object;
|
data?: object;
|
||||||
@@ -45,6 +48,12 @@ export const AddTemplate = async (data: IAddTemplate): Promise<IResult> => {
|
|||||||
const { organization, template, projectId, userId } = data;
|
const { organization, template, projectId, userId } = data;
|
||||||
const UserExists = await existingUser(userId, organization);
|
const UserExists = await existingUser(userId, organization);
|
||||||
if (!UserExists) return { status: "User not found" };
|
if (!UserExists) return { status: "User not found" };
|
||||||
|
const LivingProject = await existingProjectById(
|
||||||
|
projectId,
|
||||||
|
organization,
|
||||||
|
userId
|
||||||
|
);
|
||||||
|
if (!LivingProject) return { status: "Project not found" };
|
||||||
const existingTemplate = await templateModel(organization).findOne({
|
const existingTemplate = await templateModel(organization).findOne({
|
||||||
templateID: template.id,
|
templateID: template.id,
|
||||||
isArchive: false,
|
isArchive: false,
|
||||||
@@ -96,6 +105,12 @@ export const AddTemplateToZone = async (
|
|||||||
const { organization, templateID, projectId, zoneId, userId } = data;
|
const { organization, templateID, projectId, zoneId, userId } = data;
|
||||||
const UserExists = await existingUser(userId, organization);
|
const UserExists = await existingUser(userId, organization);
|
||||||
if (!UserExists) return { status: "User not found" };
|
if (!UserExists) return { status: "User not found" };
|
||||||
|
const LivingProject = await existingProjectById(
|
||||||
|
projectId,
|
||||||
|
organization,
|
||||||
|
userId
|
||||||
|
);
|
||||||
|
if (!LivingProject) return { status: "Project not found" };
|
||||||
const existingZone = await zoneModel(organization).findOne({
|
const existingZone = await zoneModel(organization).findOne({
|
||||||
zoneId: zoneId,
|
zoneId: zoneId,
|
||||||
isArchive: false,
|
isArchive: false,
|
||||||
@@ -238,6 +253,12 @@ export const TemplateDelete = async (data: ITemplate): Promise<IResult> => {
|
|||||||
const { templateID, projectId, userId, organization } = data;
|
const { templateID, projectId, userId, organization } = data;
|
||||||
const UserExists = await existingUser(userId, organization);
|
const UserExists = await existingUser(userId, organization);
|
||||||
if (!UserExists) return { status: "User not found" };
|
if (!UserExists) return { status: "User not found" };
|
||||||
|
const LivingProject = await existingProjectById(
|
||||||
|
projectId,
|
||||||
|
organization,
|
||||||
|
userId
|
||||||
|
);
|
||||||
|
if (!LivingProject) return { status: "Project not found" };
|
||||||
const existingTemplate = await templateModel(organization).findOne({
|
const existingTemplate = await templateModel(organization).findOne({
|
||||||
templateID: templateID,
|
templateID: templateID,
|
||||||
isArchive: false,
|
isArchive: false,
|
||||||
@@ -275,6 +296,12 @@ export const GetAllTemplates = async (data: IGetTemplate): Promise<IResult> => {
|
|||||||
const { organization, userId, projectId } = data;
|
const { organization, userId, projectId } = data;
|
||||||
const UserExists = await existingUser(userId, organization);
|
const UserExists = await existingUser(userId, organization);
|
||||||
if (!UserExists) return { status: "User not found" };
|
if (!UserExists) return { status: "User not found" };
|
||||||
|
const LivingProject = await existingProjectById(
|
||||||
|
projectId,
|
||||||
|
organization,
|
||||||
|
userId
|
||||||
|
);
|
||||||
|
if (!LivingProject) return { status: "Project not found" };
|
||||||
const templateDatas = await templateModel(organization)
|
const templateDatas = await templateModel(organization)
|
||||||
.find({ projectId: projectId, isArchive: false })
|
.find({ projectId: projectId, isArchive: false })
|
||||||
.select("-_id -__v -isArchive -createdAt -updatedAt");
|
.select("-_id -__v -isArchive -createdAt -updatedAt");
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import zoneModel from "../../V1Models/Builder/zoneModel.ts";
|
import zoneModel from "../../V1Models/Builder/zoneModel.ts";
|
||||||
import widget3dModel from "../../V1Models/Vizualization/3dwidget.ts";
|
import widget3dModel from "../../V1Models/Vizualization/3dwidget.ts";
|
||||||
import { existingUser } from "../helpers/v1projecthelperFns.ts";
|
import {
|
||||||
|
existingProjectById,
|
||||||
|
existingUser,
|
||||||
|
} from "../helpers/v1projecthelperFns.ts";
|
||||||
interface IResult {
|
interface IResult {
|
||||||
status: string;
|
status: string;
|
||||||
data?: object;
|
data?: object;
|
||||||
@@ -47,6 +50,12 @@ export const Add3DWidget = async (data: IWidget3DAdd): Promise<IResult> => {
|
|||||||
const { organization, widget, userId, zoneId, projectId } = data;
|
const { organization, widget, userId, zoneId, projectId } = data;
|
||||||
const UserExists = await existingUser(userId, organization);
|
const UserExists = await existingUser(userId, organization);
|
||||||
if (!UserExists) return { status: "User not found" };
|
if (!UserExists) return { status: "User not found" };
|
||||||
|
const LivingProject = await existingProjectById(
|
||||||
|
projectId,
|
||||||
|
organization,
|
||||||
|
userId
|
||||||
|
);
|
||||||
|
if (!LivingProject) return { status: "Project not found" };
|
||||||
const existingZone = await zoneModel(organization).findOne({
|
const existingZone = await zoneModel(organization).findOne({
|
||||||
zoneId: zoneId,
|
zoneId: zoneId,
|
||||||
isArchive: false,
|
isArchive: false,
|
||||||
@@ -120,6 +129,13 @@ export const Update3Dwidget = async (data: IWidgetUpdate): Promise<IResult> => {
|
|||||||
data;
|
data;
|
||||||
const UserExists = await existingUser(userId, organization);
|
const UserExists = await existingUser(userId, organization);
|
||||||
if (!UserExists) return { status: "User not found" };
|
if (!UserExists) return { status: "User not found" };
|
||||||
|
|
||||||
|
const LivingProject = await existingProjectById(
|
||||||
|
projectId,
|
||||||
|
organization,
|
||||||
|
userId
|
||||||
|
);
|
||||||
|
if (!LivingProject) return { status: "Project not found" };
|
||||||
const existingZone = await zoneModel(organization).findOne({
|
const existingZone = await zoneModel(organization).findOne({
|
||||||
zoneId: zoneId,
|
zoneId: zoneId,
|
||||||
isArchive: false,
|
isArchive: false,
|
||||||
@@ -183,6 +199,12 @@ export const Delete3Dwidget = async (
|
|||||||
const { organization, id, userId, zoneId, projectId } = data;
|
const { organization, id, userId, zoneId, projectId } = data;
|
||||||
const UserExists = await existingUser(userId, organization);
|
const UserExists = await existingUser(userId, organization);
|
||||||
if (!UserExists) return { status: "User not found" };
|
if (!UserExists) return { status: "User not found" };
|
||||||
|
const LivingProject = await existingProjectById(
|
||||||
|
projectId,
|
||||||
|
organization,
|
||||||
|
userId
|
||||||
|
);
|
||||||
|
if (!LivingProject) return { status: "Project not found" };
|
||||||
const existingZone = await zoneModel(organization).findOne({
|
const existingZone = await zoneModel(organization).findOne({
|
||||||
zoneId: zoneId,
|
zoneId: zoneId,
|
||||||
isArchive: false,
|
isArchive: false,
|
||||||
@@ -238,6 +260,12 @@ export const Get3Dwidget = async (data: I3dWidgetGet): Promise<IResult> => {
|
|||||||
const { organization, userId, zoneId, projectId } = data;
|
const { organization, userId, zoneId, projectId } = data;
|
||||||
const UserExists = await existingUser(userId, organization);
|
const UserExists = await existingUser(userId, organization);
|
||||||
if (!UserExists) return { status: "User not found" };
|
if (!UserExists) return { status: "User not found" };
|
||||||
|
const LivingProject = await existingProjectById(
|
||||||
|
projectId,
|
||||||
|
organization,
|
||||||
|
userId
|
||||||
|
);
|
||||||
|
if (!LivingProject) return { status: "Project not found" };
|
||||||
const existingZone = await zoneModel(organization).findOne({
|
const existingZone = await zoneModel(organization).findOne({
|
||||||
zoneId: zoneId,
|
zoneId: zoneId,
|
||||||
isArchive: false,
|
isArchive: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user