TASK22102: slice6 blob crud and retrieval contract cleanup

This commit is contained in:
2026-03-17 13:23:01 +00:00
parent 3048df3cd9
commit 98184b65df
8 changed files with 145 additions and 52 deletions
+12 -3
View File
@@ -6,6 +6,7 @@ import _ from "lodash";
import nextConnect from "next-connect";
import middleware from "../middleware/middleware";
import { hashAPIPath } from "../../../actions/core/hash";
import { respondError, respondSuccess } from "../middleware/apiResponse";
const ApiProxy = nextConnect();
ApiProxy.use(middleware);
@@ -24,7 +25,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 =
@@ -34,7 +39,11 @@ 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"
});
}
await getProgressBlobs(containerName, casefolderID)
@@ -42,7 +51,7 @@ ApiProxy.get(async (req, res) => {
return downloadProgressFile(containerName, data.path, casefolderID);
})
.then((data) => {
return res.status(200).json(data);
return respondSuccess(res, data);
});
});