vizualization updates

This commit is contained in:
2025-03-28 12:45:59 +05:30
parent b117c8705c
commit dc5d7c2ebf
59 changed files with 1977 additions and 92 deletions

View File

@@ -0,0 +1,80 @@
import { Request, Response } from "express";
import wallItenmModel from "../../../shared/model/assets/wallitems-Model.ts";
export class wallItems {
static async setWallItems(req: Request, res: Response) {
try {
const { modeluuid, modelname, position, type, csgposition,csgscale,quaternion,scale,organization } = req.body
const findvalue = await wallItenmModel(organization).findOne({ modeluuid: modeluuid})
if (findvalue) {
const updatevalue = await wallItenmModel(organization).findOneAndUpdate(
{ modeluuid: modeluuid },
{
modelname,
position,
type,
csgposition,
csgscale,
quaternion,
scale,
},
{ new: true } // Return the updated document
);
res.status(201).json(updatevalue);
} else {
const newValue = await wallItenmModel(organization).create({ modeluuid,modelname, position, type, csgposition,csgscale,quaternion,scale });
res.status(201).json(newValue);
}
// Send response with the created document
} catch (error) {
console.error('Error creating wallitems:', error);
res.status(500).json({ message: "Failed to create wallitems" });
}
}
static async getWallItems(req: Request, res: Response) {
try {
const { organization } = req.params;
const findValue = await wallItenmModel
(organization).find()
if (!findValue) {
res.status(200).json("wallitems not found");
} else {
res.status(201).json(findValue);
}
} catch (error) {
console.error('Error get wallitems:', error);
res.status(500).json({ error: "Failed to get wallitems" });
}
}
static async deleteWallItems(req: Request, res: Response) {
try {
const { modeluuid,modelname,organization } = req.body;
const findValue = await wallItenmModel
(organization).findOneAndDelete({modeluuid:modeluuid,modelname:modelname})
if (!findValue) {
res.status(200).json("user not found");
} else {
res.status(201).json(findValue);
}
} catch (error) {
console.error('Error get wallitems:', error);
res.status(500).json({ error: "Failed to get wallitems" });
}
}
}