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
+14 -7
View File
@@ -1,5 +1,6 @@
import { hashAPIPath } from "../../../actions/core/hash";
import { deleteBlobCase } from "../../../actions/azurestorage";
import { respondError, respondSuccess } from "../middleware/apiResponse";
import nextConnect from "next-connect";
import middleware from "../middleware/middleware";
@@ -20,7 +21,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 =
@@ -30,14 +35,16 @@ ApiProxy.get(async (req, res) => {
casefolderID;
if (hashAPIPath(checkquerypath) != "&hash=" + checkHash) {
return res.status(400).json();
}
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
await deleteBlobCase(containerName, casefolderID).then((data) => {
return res.status(200).json({ data: data });
return respondError(res, {
status: 400,
code: "INVALID_HASH",
message: "Invalid hash"
});
}
await deleteBlobCase(containerName, casefolderID).then((data) => {
return respondSuccess(res, { data: data });
});
});
export const config = {