TASK22102: slice6 blob crud and retrieval contract cleanup
This commit is contained in:
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user