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

@@ -15,8 +15,8 @@ export const CreateZoneController = async (
): Promise<void> => {
try {
const { organization, userId } = req.user || {};
const { zoneData, projectId } = req.body;
if (!organization || !userId || !zoneData || !projectId) {
const { zoneData, projectId, versionId } = req.body;
if (!organization || !userId || !zoneData || !projectId || !versionId) {
res.status(400).json({
message: "All fields are required",
});
@@ -25,6 +25,7 @@ export const CreateZoneController = async (
const data = {
zoneData,
projectId,
versionId,
organization,
userId,
};
@@ -41,6 +42,11 @@ export const CreateZoneController = async (
message: "Project not found",
});
break;
case "Version Data not found":
res.status(404).json({
message: "Version Data not found",
});
break;
case "zone updated":
res.status(200).json({
message: "zone updated",
@@ -71,8 +77,8 @@ export const DeleteZoneController = async (
): Promise<void> => {
try {
const { organization, userId } = req.user || {};
const { zoneUuid, projectId } = req.body;
if (!organization || !userId || !zoneUuid || !projectId) {
const { zoneUuid, projectId, versionId } = req.body;
if (!organization || !userId || !zoneUuid || !projectId || !versionId) {
res.status(400).json({
message: "All fields are required",
});
@@ -82,6 +88,7 @@ export const DeleteZoneController = async (
organization,
zoneUuid,
projectId,
versionId,
userId,
});
@@ -96,6 +103,11 @@ export const DeleteZoneController = async (
message: "Project not found",
});
break;
case "Version Data not found":
res.status(404).json({
message: "Version Data not found",
});
break;
case "Invalid zone ID":
res.status(404).json({
message: "Zone not found for the UUID",
@@ -124,7 +136,7 @@ export const GetZoneController = 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",
@@ -135,6 +147,7 @@ export const GetZoneController = async (
organization,
projectId,
userId,
versionId,
});
switch (result.status) {
@@ -148,6 +161,11 @@ export const GetZoneController = async (
message: "Project not found",
});
break;
case "Version Data not found":
res.status(404).json({
message: "Version Data not found",
});
break;
case "Invalid zone":
res.status(404).json({
message: "Zone not found for the UUID",
@@ -174,7 +192,7 @@ export const VizZoneController = 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",
@@ -184,6 +202,7 @@ export const VizZoneController = async (
const result = await VizZoneDatas({
organization,
projectId,
versionId,
userId,
});
@@ -198,6 +217,11 @@ export const VizZoneController = async (
message: "Project not found",
});
break;
case "Version Data not found":
res.status(404).json({
message: "Version Data not found",
});
break;
case "Zone not found for the UUID":
res.status(200).json(result.data);
break;
@@ -223,7 +247,7 @@ export const ZoneDataController = async (
): Promise<void> => {
try {
const { organization, userId } = req.user || {};
const { projectId, zoneUuid } = req.params;
const { projectId, zoneUuid, versionId } = req.params;
if (!organization || !userId || !projectId || !zoneUuid) {
res.status(400).json({
message: "All fields are required",
@@ -234,6 +258,7 @@ export const ZoneDataController = async (
organization,
projectId,
userId,
versionId,
zoneUuid,
});
@@ -248,6 +273,11 @@ export const ZoneDataController = async (
message: "Project not found",
});
break;
case "Version Data not found":
res.status(404).json({
message: "Version Data not found",
});
break;
case "Zone not found":
res.status(404).json({
message: "Zone not found",
@@ -274,7 +304,7 @@ export const SingleZonePanelController = async (
): Promise<void> => {
try {
const { organization, userId } = req.user || {};
const { projectId, zoneUuid } = req.params;
const { versionId, projectId, zoneUuid } = req.params;
if (!organization || !userId || !projectId || !zoneUuid) {
res.status(400).json({
message: "All fields are required",
@@ -285,6 +315,7 @@ export const SingleZonePanelController = async (
organization,
projectId,
userId,
versionId,
zoneUuid,
});
@@ -299,6 +330,11 @@ export const SingleZonePanelController = async (
message: "Project not found",
});
break;
case "Version Data not found":
res.status(404).json({
message: "Version Data not found",
});
break;
case "Zone not found for the UUID":
res.status(404).json({
message: "Zone not found for the UUID",