TASK22102: slice2 migrate remaining email handlers

This commit is contained in:
2026-03-17 12:55:05 +00:00
parent 9ae8ce7136
commit f16161bcee
5 changed files with 72 additions and 19 deletions
+32
View File
@@ -1339,3 +1339,35 @@ Follow-ups:
- Slice 2 should migrate remaining email handlers (`getcaseref`, `getall`, `getevents`, `getdocuments`) to helper responses.
- After email/admin completion, expand to selected high-risk file handlers using same non-breaking helper model.
---
### CL-036: TASK22102 API contract consistency — Slice 2 (remaining email handlers)
date: 2026-03-17
author: Cline
scope: `pages/api/email/{getcaseref,getall,getevents,getdocuments}.js`
type: change
rationale: Complete the email-domain response-contract consistency rollout by moving remaining handlers to shared helper-based success/error responses.
impact: Removes raw error passthrough in remaining email handlers and standardizes structured error envelopes while preserving success payload compatibility.
status: completed
Summary:
- Migrated remaining email handlers to shared response helper usage:
- `getcaseref`
- `getall`
- `getevents`
- `getdocuments`
- Replaced direct `res.status(...).json(...)` branches with:
- `respondSuccess(...)`
- `respondError(...)`
- Added stable error codes/messages for expected negative paths and catch branches.
Validation:
- `npx next lint --file pages/api/email/getcaseref.js --file pages/api/email/getevents.js --file pages/api/email/getdocuments.js --file pages/api/email/getall.js` -> pass (no warnings/errors)
Follow-ups:
- Next slice can target selected file handlers for equivalent response contract cleanup.