Builder Based projectID Service processing for camera,walll,lines, zones

This commit is contained in:
2025-05-28 13:01:55 +05:30
parent 2c28ffe9aa
commit 6b5bee879b
12 changed files with 453 additions and 44 deletions

View File

@@ -1,5 +1,5 @@
import { Request, Response } from "express";
import wallItemModel from "../../../shared/model/builder/assets/wallitems-Model.ts";
import { existingUser } from "../helpers/v1projecthelperFns.ts";
interface IWallSetupData {
modelUuid: string;
modelName: string;
@@ -11,10 +11,10 @@ interface IWallSetupData {
scale: [];
organization: string;
projectId: string;
userId: string;
}
interface IWallGet {
userId: string;
role: string;
organization: string;
projectId: string;
}
@@ -22,7 +22,6 @@ interface IWallDelete {
userId: string;
modelUuid: string;
modelName: string;
role: string;
organization: string;
projectId: string;
}
@@ -34,6 +33,7 @@ export class WallItems {
static async setWallItems(data: IWallSetupData): Promise<IWallItemResult> {
try {
const {
userId,
modelUuid,
modelName,
position,
@@ -45,6 +45,8 @@ export class WallItems {
projectId,
organization,
} = data;
const UserExists = await existingUser(userId, organization);
if (!UserExists) return { status: "User not found" };
const findvalue = await wallItemModel(organization).findOne({
modelUuid: modelUuid,
});
@@ -100,9 +102,12 @@ export class WallItems {
}
static async getWallItems(data: IWallGet) {
try {
const { organization, role, userId, projectId } = data;
const findValue = await wallItemModel(organization).find();
const { organization, userId, projectId } = data;
const UserExists = await existingUser(userId, organization);
if (!UserExists) return { status: "User not found" };
const findValue = await wallItemModel(organization).find({
projectId: projectId,
});
if (!findValue) {
return {
status: "wallitems not found",
@@ -127,9 +132,9 @@ export class WallItems {
}
static async deleteWallItems(data: IWallDelete): Promise<IWallItemResult> {
try {
const { modelUuid, modelName, organization, userId, projectId, role } =
data;
const { modelUuid, modelName, organization, userId, projectId } = data;
const UserExists = await existingUser(userId, organization);
if (!UserExists) return { status: "User not found" };
const findValue = await wallItemModel(organization).findOneAndDelete({
modelUuid: modelUuid,
modelName: modelName,