TASK22102: slice6 blob crud and retrieval contract cleanup
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { hashAPIPath } from "../../../actions/core/hash";
|
||||
import { deleteBlob } from "../../../actions/azurestorage";
|
||||
import { respondError, respondSuccess } from "../middleware/apiResponse";
|
||||
|
||||
import nextConnect from "next-connect";
|
||||
import middleware from "../middleware/middleware";
|
||||
@@ -23,7 +24,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, blobname and hash are required"
|
||||
});
|
||||
}
|
||||
|
||||
var checkquerypath =
|
||||
@@ -35,12 +40,16 @@ ApiProxy.get(async (req, res) => {
|
||||
encodeURIComponent(blobName);
|
||||
|
||||
if (hashAPIPath(checkquerypath) != "&hash=" + checkHash) {
|
||||
return res.status(400).json();
|
||||
return respondError(res, {
|
||||
status: 400,
|
||||
code: "INVALID_HASH",
|
||||
message: "Invalid hash"
|
||||
});
|
||||
}
|
||||
|
||||
await deleteBlob(containerName, casefolderID + "/files/" + blobName).then(
|
||||
(data) => {
|
||||
return res.status(200).json({ data: data });
|
||||
return respondSuccess(res, { data: data });
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user