TASK22102: slice3 migrate file proxy handlers

This commit is contained in:
2026-03-17 12:58:20 +00:00
parent f16161bcee
commit 3cbd876b77
5 changed files with 80 additions and 12 deletions
+12 -3
View File
@@ -3,6 +3,7 @@ import { azureHeaders } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { hashAPIPath } from "../../../actions/core/hash";
import axios from "axios";
import { respondError, respondSuccess } from "../middleware/apiResponse";
const BASE_URL = process.env.API_ROOT || `http://localhost:${port}`;
@@ -14,7 +15,11 @@ export default async function ApiProxy(req, res) {
var casefolderID = req.query.casefolderID;
if (!hasValue(containerName) || !hasValue(casefolderID)) {
return res.status(400).json();
return respondError(res, {
status: 400,
code: "MISSING_REQUIRED_QUERY",
message: "container and casefolderID are required"
});
}
var token = await getToken();
@@ -31,10 +36,14 @@ export default async function ApiProxy(req, res) {
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
return respondSuccess(res, data);
})
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
return respondError(res, {
status: 400,
code: "GET_BLOB_LIST_PROXY_FAILED",
message: "Failed to fetch blob list"
});
});
}