Collaboration completed for builder,dashboard, visualization for API and socket

This commit is contained in:
2025-06-04 17:25:46 +05:30
parent 591d86c274
commit 5216ee190a
40 changed files with 1045 additions and 674 deletions

View File

@@ -11,7 +11,6 @@ export const SignupController = async (
res: Response
): Promise<void> => {
try {
console.log("req.body: ", req.body);
const { userName, Email, Password } = req.body;
if (!userName || !Email || !Password) {
res.status(400).json({
@@ -20,7 +19,6 @@ export const SignupController = async (
return;
}
const result = await AuthSignup(req.body);
console.log('result: ', result);
switch (result.status) {
case "User already exists":
@@ -53,7 +51,6 @@ export const SignInController = async (
): Promise<void> => {
try {
const { Email, Password, fingerprint } = req.body;
console.log("req.body: ", req.body);
if (!fingerprint || !Email || !Password) {
res.status(400).json({
message: "All fields are required",

View File

@@ -20,16 +20,7 @@ export const SetEnvironmentController = async (
shadowVisibility,
projectId,
} = req.body;
if (
!organization ||
!userId ||
!roofVisibility ||
!wallVisibility ||
!renderDistance ||
!limitDistance ||
!shadowVisibility ||
!projectId
) {
if (!organization || !userId || !projectId) {
res.status(400).json({
message: "All fields are required",
});
@@ -45,7 +36,7 @@ export const SetEnvironmentController = async (
renderDistance,
limitDistance,
};
const result = await setEnvironment(data);
const result = await setEnvironment(req.body);
switch (result.status) {
case "User not found":
@@ -71,7 +62,6 @@ export const SetEnvironmentController = async (
break;
}
} catch (error) {
console.log("error: ", error);
res.status(500).json({
message: "Unknown error",
});
@@ -109,9 +99,7 @@ export const GetEnvironmentController = async (
});
break;
case "Environment Not found for the User":
res.status(404).json({
message: "Environment Not found for the User",
});
res.status(200).json(result.data);
break;
case "Success":
res.status(200).json(result.data);
@@ -123,7 +111,6 @@ export const GetEnvironmentController = async (
break;
}
} catch (error) {
console.log("error: ", error);
res.status(500).json({
message: "Unknown error",
});

View File

@@ -53,7 +53,6 @@ export const NewLineController = async (
break;
}
} catch (error) {
console.log("error: ", error);
res.status(500).json({
message: "Unknown error",
});
@@ -290,6 +289,9 @@ export const GetLinesController = async (
message: "Project not found",
});
break;
case "Line not found":
res.status(200).json(result.data);
break;
case "Success":
res.status(200).json(result.data);
break;

View File

@@ -84,7 +84,6 @@ export const CreateAssetController = async (
break;
}
} catch (error) {
console.log("error: ", error);
res.status(500).json({
message: "Unknown error",
});
@@ -180,9 +179,7 @@ export const GetAssetController = async (
});
break;
case "floorItems not found":
res.status(404).json({
message: "floorItems not found",
});
res.status(200).json([]);
break;
case "Success":
res.status(200).json(result.data);

View File

@@ -13,14 +13,14 @@ export const SetNewCamera = async (
): Promise<void> => {
try {
const { organization, userId } = req.user || {};
const { position, target, rotation, projectId} = req.body;
const { position, target, rotation, projectId } = req.body;
if (
!organization ||
!userId ||
!position ||
!target ||
!rotation ||
!projectId
!projectId
) {
res.status(400).json({
message: "All fields are required",
@@ -62,7 +62,6 @@ export const SetNewCamera = async (
break;
}
} catch (error) {
console.log("error: ", error);
res.status(500).json({
message: "Unknown error",
});
@@ -98,6 +97,9 @@ export const CameraList = async (
message: "Project not found",
});
break;
case "Camera not found":
res.status(200).json(result.data);
break;
case "Success":
res.status(200).json(result.data);
break;

View File

@@ -113,9 +113,7 @@ export const WallGet = async (
});
break;
case "wallitems not found":
res.status(404).json({
message: "wallitems not found",
});
res.status(200).json(result.data);
break;
case "Success":
res.status(200).json(result.data);

View File

@@ -60,7 +60,6 @@ export const CreateZoneController = async (
break;
}
} catch (error) {
console.log("error: ", error);
res.status(500).json({
message: "Unknown error",
});
@@ -104,7 +103,7 @@ export const DeleteZoneController = async (
break;
case "Success":
res.status(200).json({
message:"Zone deleted successfully"
message: "Zone deleted successfully",
});
break;
default:
@@ -200,9 +199,7 @@ export const VizZoneController = async (
});
break;
case "Zone not found for the UUID":
res.status(404).json({
message: "Zone not found for the UUID",
});
res.status(200).json(result.data);
break;
case "Success":
res.status(200).json(result.data);

View File

@@ -208,7 +208,7 @@ export const ViewData = async (
): Promise<void> => {
try {
const { organization, userId, role } = req.user || {};
if (!req.user?.userId || !req.user?.organization) {
if (!req.user?.userId || !req.user?.organization) {
res.status(401).json({ message: "Unauthorized" });
return;
}
@@ -263,7 +263,6 @@ export const ProjectDuplicateController = async (
try {
const { userId, organization } = req.user || {};
const { projectUuid, thumbnail, projectName } = req.body;
if (!req.user?.userId || !req.user?.organization) {
res.status(401).json({ message: "Unauthorized" });
return;

View File

@@ -45,7 +45,6 @@ export const GetTrashList = async (
break;
}
} catch (error) {
console.log("error: ", error);
res.status(500).json({
message: "Unknown error",
});

View File

@@ -6,7 +6,6 @@ export const versioncontroller = async (
res: Response
): Promise<void> => {
try {
console.log("req.body: ", req.body);
const { projectId, userId, description, db } = req.body;
const result = await versionService.saveCurrentStateAsVersion(
@@ -16,7 +15,6 @@ export const versioncontroller = async (
description
);
console.log(result);
} catch (error) {
res.status(500).json({
message: "An unexpected error occurred",

View File

@@ -0,0 +1,18 @@
import express from "express";
import { tokenValidator } from "../../../../shared/utils/token.ts";
import {
GetEnvironmentController,
SetEnvironmentController,
} from "../../v1Controllers/builderController/v1EnvironmentController.ts";
const v1Environment = express.Router();
v1Environment.post("/SetEnvironments", tokenValidator, SetEnvironmentController);
v1Environment.get(
"/Environments/:projectId",
tokenValidator,
GetEnvironmentController
);
export default v1Environment;

View File

@@ -35,16 +35,22 @@ import v1PanelRoutes from "./V1/v1Routes/vizRoutes.ts/v1-panelRoutes.ts";
import v1Template from "./V1/v1Routes/vizRoutes.ts/v1-TemplateRoutes.ts";
import v1Widget from "./V1/v1Routes/vizRoutes.ts/v1-widgetRoutes.ts";
import v1Widget3d from "./V1/v1Routes/vizRoutes.ts/v1-widget3dRoutes.ts";
redis
import v1Environment from "./V1/v1Routes/BuilderRoutes/v1-environmentRoutes.ts";
redis;
const app = express();
app.use(cors());
app.use(
cors({
origin: "*",
credentials: true,
exposedHeaders: ["x-access-token"],
})
);
app.use(express.json({ limit: "50mb" }));
app.use(
express.urlencoded({ limit: "50mb", extended: true, parameterLimit: 50000 })
);
dotenv.config();
app.use(cors());
app.use(express.json());
app.get("/", (req, res) => {
res.send("Hello, I am Major-Dwinzo API!");
@@ -77,6 +83,7 @@ app.use("/api/V1", v1TrashRoutes);
app.use("/api/V1", v1homeRoutes);
app.use("/api/V1", v1Asset);
app.use("/api/V1", v1Camera);
app.use("/api/V1", v1Environment);
app.use("/api/V1", v1Line);
app.use("/api/V1", v1Wall);
app.use("/api/V1", v1Zone);

View File

@@ -13,7 +13,6 @@ export class Environment {
renderDistance,
limitDistance,
} = req.body;
const findvalue = await environmentModel(organization).findOne({
userId: userId,
});