TASK22102: slice7 complex file handler contract closeout

This commit is contained in:
2026-03-17 13:25:51 +00:00
parent 98184b65df
commit 91890f4d73
4 changed files with 109 additions and 67 deletions
+21 -13
View File
@@ -31,6 +31,7 @@
import { hashAPIPath } from "../../../actions/core/hash";
import { getBlobs, getRepsFilesBlobs } from "../../../actions/azurestorage";
import { respondError, respondSuccess } from "../middleware/apiResponse";
import nextConnect from "next-connect";
import middleware from "../middleware/middleware";
@@ -52,7 +53,11 @@ ApiProxy.get(async (req, res) => {
typeof checkHash === "undefined" ||
checkHash.length === 0
) {
return res.status(400).json();
return respondError(res, {
status: 400,
code: "MISSING_REQUIRED_QUERY",
message: "container, casefolderID and hash are required"
});
}
var checkquerypath =
@@ -62,20 +67,23 @@ ApiProxy.get(async (req, res) => {
casefolderID;
if (hashAPIPath(checkquerypath) != "&hash=" + checkHash) {
return res.status(400).json();
return respondError(res, {
status: 400,
code: "INVALID_HASH",
message: "Invalid hash"
});
}
casefolderID.split("/").length > 1
? await getRepsFilesBlobs(
containerName,
casefolderID.split("/")[0],
casefolderID.split("/")[1]
).then((data) => {
return res.status(200).json({ "value": [data] });
})
: await getBlobs(containerName, casefolderID).then((data) => {
return res.status(200).json({ "value": [data] });
});
const data =
casefolderID.split("/").length > 1
? await getRepsFilesBlobs(
containerName,
casefolderID.split("/")[0],
casefolderID.split("/")[1]
)
: await getBlobs(containerName, casefolderID);
return respondSuccess(res, { "value": [data] });
});
export const config = {