Controller and routing for the Vizualtion and builder

This commit is contained in:
2025-05-29 15:34:12 +05:30
parent bea6044b25
commit c38a698692
34 changed files with 2523 additions and 926 deletions

View File

@@ -49,11 +49,12 @@ export class WallItems {
if (!UserExists) return { status: "User not found" };
const findvalue = await wallItemModel(organization).findOne({
modelUuid: modelUuid,
isArchive: false,
});
if (findvalue) {
const updatevalue = await wallItemModel(organization).findOneAndUpdate(
{ modelUuid: modelUuid, projectId: projectId },
{ modelUuid: modelUuid, projectId: projectId, isArchive: false },
{
modelName,
position,
@@ -63,13 +64,12 @@ export class WallItems {
quaternion,
scale,
},
{ new: true } // Return the updated document
{ new: true }
);
return {
status: "Updated successfully",
data: updatevalue,
};
// res.status(201).json(updatevalue);
} else {
const newValue = await wallItemModel(organization).create({
modelUuid,
@@ -86,7 +86,6 @@ export class WallItems {
status: "wall Item created successfully",
data: newValue,
};
// res.status(201).json(newValue);
}
} catch (error: unknown) {
if (error instanceof Error) {
@@ -107,6 +106,7 @@ export class WallItems {
if (!UserExists) return { status: "User not found" };
const findValue = await wallItemModel(organization).find({
projectId: projectId,
isArchive: false,
});
if (!findValue) {
return {
@@ -139,6 +139,7 @@ export class WallItems {
modelUuid: modelUuid,
modelName: modelName,
projectId: projectId,
isArchive: false,
});
if (!findValue) {
return {