Controller and routing for the Vizualtion and builder
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user