refactor(api): migrate batch 12 remaining relay-get candidates
This commit is contained in:
@@ -1071,3 +1071,39 @@ Validation:
|
||||
Follow-ups:
|
||||
|
||||
- Continue P2-S2 with remaining legacy relay GET candidates (`createwatchedcases_api`, `deletewatchedcasesproxy_api`, `getadvancedsearch_api`, `getbasicsearch_by_address_api`, `getbasicsearch_by_lparref_api`, `getdnscoords_api`).
|
||||
|
||||
---
|
||||
|
||||
### CL-029: TASK22229 P2-S2 Batch 12 (remaining relay GET candidates)
|
||||
|
||||
date: 2026-03-24
|
||||
author: Cline
|
||||
scope: `pages/api/middleware/relayForwarding.js`, `pages/api/endpoint/{createwatchedcases_api,deletewatchedcasesproxy_api,getadvancedsearch_api,getbasicsearch_by_address_api,getbasicsearch_by_lparref_api,getdnscoords_api}.js`, `tests/phase21/endpoint-handler-contract.test.cjs`
|
||||
type: change
|
||||
rationale: Complete Batch 12 by migrating the remaining listed legacy relay GET candidates to shared forwarding helpers while preserving endpoint-specific validation, transforms, and error contracts.
|
||||
impact: Consolidated relay GET behavior and reduced endpoint-level relay boilerplate; no intended API contract changes.
|
||||
status: completed
|
||||
|
||||
Summary:
|
||||
|
||||
- Extended relay middleware with reusable helpers:
|
||||
- `relayGetData` now supports token reuse via `transformData` path
|
||||
- Added `forwardGetData` to support custom base URLs (used by proxy-to-local endpoint) while preserving hash behavior
|
||||
- Migrated remaining Batch 12 candidates:
|
||||
- `getadvancedsearch_api.js` -> `relayGet` + `relayGetData` for project-type enrichment loop
|
||||
- `getdnscoords_api.js` -> `relayGetData` for both DNS + SIPS source pulls
|
||||
- `getbasicsearch_by_lparref_api.js` -> `relayGetData`
|
||||
- `getbasicsearch_by_address_api.js` -> `relayGetData` for appeal-type and incident fetches
|
||||
- `deletewatchedcasesproxy_api.js` -> `forwardGetData` with `BASE_URL`
|
||||
- `createwatchedcases_api.js` -> `relayGetData` for record-exists pre-check (POST/PATCH upsert flow preserved)
|
||||
- Preserved endpoint-specific guard and error contracts (including status codes such as 500 for `BASIC_SEARCH_BY_ADDRESS_FETCH_FAILED`).
|
||||
- Updated phase21 endpoint contract tests for migrated handlers to mock `relayGetData` / `forwardGetData` where appropriate.
|
||||
|
||||
Validation:
|
||||
|
||||
- `node tests/phase21/endpoint-handler-contract.test.cjs` -> pass (152/152)
|
||||
- `npm run lint` -> warnings only (pre-existing `react-hooks/exhaustive-deps`; no new lint errors)
|
||||
|
||||
Follow-ups:
|
||||
|
||||
- Batch 12 completes the previously listed remaining P2-S2 relay GET candidates.
|
||||
|
||||
Reference in New Issue
Block a user