From 13dbb8b2d09e13f4c5a050cc54813203d019232d Mon Sep 17 00:00:00 2001 From: robbond Date: Wed, 25 Mar 2026 06:48:54 +0000 Subject: [PATCH] refactor(actions): adopt endpoint client in document service posts --- actions/services/documentDirectService.js | 17 ++++------- memory-bank/change-log.md | 35 +++++++++++++++++++++++ 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/actions/services/documentDirectService.js b/actions/services/documentDirectService.js index 77e1a579..dd7739ee 100644 --- a/actions/services/documentDirectService.js +++ b/actions/services/documentDirectService.js @@ -3,7 +3,7 @@ import { BASE_URL } from "../core/env"; import { consoleLogger } from "../core/logger"; import { hashAPIPath } from "../core/hash"; import { buildHashedQueryUrl } from "../clients/relayClient"; -import { getJson } from "../clients/endpointClient"; +import { getJson, requestJson } from "../clients/endpointClient"; export const getAwaitingSubmissionFromBlob = (containerName) => { return axios @@ -153,8 +153,7 @@ export const uploadFiles = async ( }; try { - const res = await axios(config); - return res.data; + return await requestJson(config); } catch (error) { consoleLogger(error); } @@ -183,8 +182,7 @@ export const uploadSingleFile = async (filesObj, containerID, casefolderID) => { }; try { - const res = await axios(config); - return res.data; + return await requestJson(config); } catch (error) { consoleLogger(error); } @@ -214,8 +212,7 @@ export const uploadRepFiles = async ( }; try { - const res = await axios(config); - return res.data; + return await requestJson(config); } catch (error) { consoleLogger(error); } @@ -240,8 +237,7 @@ export const generateRepPDF = async ( }; try { - const res = await axios(config); - return res.data; + return await requestJson(config); } catch (error) { consoleLogger(error); } @@ -274,8 +270,7 @@ export const generateAppealPDF = async ( }; try { - const res = await axios(config); - return res.data; + return await requestJson(config); } catch (error) { consoleLogger(error); } diff --git a/memory-bank/change-log.md b/memory-bank/change-log.md index a8f66fd9..655883f6 100644 --- a/memory-bank/change-log.md +++ b/memory-bank/change-log.md @@ -1634,3 +1634,38 @@ Validation: Follow-ups: - Optional next bounded slice: migrate selected `requestJson`-eligible upload/generation helpers in `documentDirectService` (non-download paths) while preserving multipart/blob behavior. + +--- + +### CL-045: TASK22260 next slice — document direct service requestJson adoption (uploads + PDF generation) + +date: 2026-03-25 +author: Cline +scope: `actions/services/documentDirectService.js` +type: change +rationale: Continue bounded client migration by moving config-based multipart/PDF POST helpers in document service to shared `requestJson` while preserving hashed URL generation and responseType behavior. +impact: Reduces repeated axios config execution boilerplate and aligns document POST helper internals with shared endpoint client conventions. +status: completed + +Summary: + +- Migrated selected config-based document helper flows from `axios(config)` + `res.data` to `requestJson(config)`: + - `uploadFiles` + - `uploadSingleFile` + - `uploadRepFiles` + - `generateRepPDF` + - `generateAppealPDF` +- Preserved behavior-critical aspects: + - hashed URL creation via `buildHashedQueryUrl(...)` + - multipart headers for upload flows + - conditional `responseType: "blob"` for download PDF option paths + - existing catch-path logging semantics +- Left delete/download/hash-sensitive GET helpers unchanged in this slice. + +Validation: + +- `npm run lint` -> warnings only (pre-existing `react-hooks/exhaustive-deps`; no new lint errors) + +Follow-ups: + +- Optional next bounded slice: evaluate remaining legacy direct `axios.get(...).then(res.data)` helpers in `documentDirectService` (`getAwaitingSubmissionFromBlob`, `getRepsFromBlob`, `getFilesFromBlob`) for safe migration while preserving signed hash path behavior.