Latest Project, Trash and setting API and sockets along with the Model clearance
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Request, Response } from "express";
|
||||
import floorItemsModel from "../../../shared/model/assets/flooritems-Model.ts";
|
||||
|
||||
export class floorItems {
|
||||
export class FloorItems {
|
||||
static async setFloorItems(req: Request, res: Response) {
|
||||
try {
|
||||
const {
|
||||
@@ -57,7 +57,6 @@ export class floorItems {
|
||||
static async getFloorItems(req: Request, res: Response) {
|
||||
try {
|
||||
const { organization } = req.params;
|
||||
// console.log('req.params: ', req.params);
|
||||
|
||||
const findValue = await floorItemsModel(organization).find();
|
||||
if (!findValue) {
|
||||
|
||||
@@ -74,7 +74,7 @@ interface IPointStaticMachine extends IPointBase {
|
||||
targets: { modelUUID: string; pointUUID: string }[];
|
||||
};
|
||||
}
|
||||
export class pointService {
|
||||
export class PointService {
|
||||
static async addPoints(req: Request, res: Response): Promise<any> {
|
||||
const { type, modelfileID, organization } = req.body;
|
||||
|
||||
|
||||
@@ -1,80 +1,92 @@
|
||||
import { Request, Response } from "express";
|
||||
import wallItenmModel from "../../../shared/model/assets/wallitems-Model.ts";
|
||||
import wallItemModel from "../../../shared/model/builder/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;
|
||||
|
||||
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 wallItemModel(organization).findOne({
|
||||
modelUuid: modelUuid,
|
||||
});
|
||||
|
||||
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);
|
||||
|
||||
if (findvalue) {
|
||||
const updatevalue = await wallItemModel(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 wallItemModel(organization).create({
|
||||
modelUuid,
|
||||
modelName,
|
||||
position,
|
||||
type,
|
||||
csgposition,
|
||||
csgscale,
|
||||
quaternion,
|
||||
scale,
|
||||
});
|
||||
|
||||
} else {
|
||||
const newValue = await wallItenmModel(organization).create({ modelUuid,modelName, position, type, csgposition,csgscale,quaternion,scale });
|
||||
res.status(201).json(newValue);
|
||||
}
|
||||
|
||||
|
||||
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" });
|
||||
}
|
||||
// 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;
|
||||
|
||||
}
|
||||
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" });
|
||||
}
|
||||
const findValue = await wallItemModel(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;
|
||||
|
||||
}
|
||||
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" });
|
||||
}
|
||||
const findValue = await wallItemModel(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" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user