collection edge collaborated API
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Request, Response } from "express";
|
||||
import {
|
||||
GetNodesInProject,
|
||||
projectCreationService,
|
||||
projectDatas,
|
||||
} from "../../shared/services/projectService";
|
||||
@@ -119,3 +120,49 @@ export const getProjects = async (
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const NodesCollectionsBasedOnproject = async (
|
||||
req: Request,
|
||||
res: Response
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { projectId, organization } = req.params;
|
||||
if (!organization || !projectId) {
|
||||
res.status(400).json({
|
||||
message: "All fields are required",
|
||||
});
|
||||
return;
|
||||
}
|
||||
const data = {
|
||||
organization,
|
||||
projectId,
|
||||
};
|
||||
const result = await GetNodesInProject(data);
|
||||
switch (result.status) {
|
||||
case "project not found":
|
||||
res.status(200).json({
|
||||
message: "project not found",
|
||||
});
|
||||
break;
|
||||
case "No collection Nodes present":
|
||||
res.status(200).json({
|
||||
message: "No collection Nodes present",
|
||||
Collections: result.data,
|
||||
});
|
||||
break;
|
||||
case "Success":
|
||||
res.status(200).json(result.data);
|
||||
break;
|
||||
default:
|
||||
res.status(500).json({
|
||||
message: "Internal server error",
|
||||
});
|
||||
break;
|
||||
}
|
||||
} catch (error) {
|
||||
res.status(500).json({
|
||||
message: "Unknown error",
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user