Version based API - Pushed here before the 5000 and 8000

This commit is contained in:
2025-06-21 15:16:52 +05:30
parent dead851b1a
commit 3ec45276f4
114 changed files with 7547 additions and 1436 deletions

View File

@@ -12,8 +12,8 @@ export const UpsertAisleController = async (
): Promise<void> => {
try {
const { organization, userId } = req.user || {};
const { aisleUuid, points, type, projectId } = req.body;
if (!organization || !userId || !aisleUuid || !projectId) {
const { aisleUuid, points, type, projectId, versionId } = req.body;
if (!organization || !userId || !aisleUuid || !projectId || !versionId) {
res.status(400).json({
message: "All fields are required",
});
@@ -24,6 +24,7 @@ export const UpsertAisleController = async (
type,
aisleUuid,
projectId,
versionId,
organization,
userId,
};
@@ -39,6 +40,11 @@ export const UpsertAisleController = async (
message: "Project not found",
});
break;
case "Version Data not found":
res.status(404).json({
message: "Version Data not found",
});
break;
case "Aisle Not Updated":
res.status(200).json({
message: "Aisle Not Updated",
@@ -83,8 +89,8 @@ export const DeleteAisleController = async (
): Promise<void> => {
try {
const { organization, userId } = req.user || {};
const { aisleUuid, projectId } = req.body;
if (!organization || !userId || !aisleUuid || !projectId) {
const { aisleUuid, projectId, versionId } = req.body;
if (!organization || !userId || !aisleUuid || !projectId || !versionId) {
res.status(400).json({
message: "All fields are required",
});
@@ -95,6 +101,7 @@ export const DeleteAisleController = async (
projectId,
organization,
userId,
versionId,
};
const result = await DeleteAisle(data);
switch (result.status) {
@@ -108,6 +115,11 @@ export const DeleteAisleController = async (
message: "Project not found",
});
break;
case "Version Data not found":
res.status(404).json({
message: "Version Data not found",
});
break;
case "Aisle not found":
res.status(200).json({
message: "Aisle not found",
@@ -136,7 +148,7 @@ export const AllAisleController = async (
): Promise<void> => {
try {
const { organization, userId } = req.user || {};
const { projectId } = req.params;
const { projectId, versionId } = req.params;
if (!organization || !userId || !projectId) {
res.status(400).json({
message: "All fields are required",
@@ -145,6 +157,7 @@ export const AllAisleController = async (
}
const data = {
projectId,
versionId,
organization,
userId,
};
@@ -160,6 +173,11 @@ export const AllAisleController = async (
message: "Project not found",
});
break;
case "Version Data not found":
res.status(404).json({
message: "Version Data not found",
});
break;
case "Aisle not found":
res.status(200).json(result.data);
break;