refactor(api): extract apiError/boolCodec/logger/paginate helpers — Candidate 1
Five thin service adapters (student/subject/term/story/task) now route
through three pure helpers:
- apiError.js — normalize axios errors (status, message, detail, original)
- boolCodec.js — parse DRF Y/N/true/false/etc. into strict booleans
- logger.js — tag-prefixed console output (swap to no-op in tests)
- paginate.js — DRF paginated-list walker with page_size:100 + 100-page cap
apiEndpoints lifted from src/api/index.js (was stale) into its own
endpoints.js single source of truth. Service tests gain 4 new spec
files (apiError/boolCodec/logger/paginate).
The duplicated fetchAllPages() copy in studentService and taskService
is now a single import; either delete the old code or accept the
temporary duplication until a follow-up candidate collapses it.
Co-Authored-By:
Claude <noreply@anthropic.com>
src/api/apiError.js
0 → 100644
src/api/boolCodec.js
0 → 100644
src/api/endpoints.js
0 → 100644
src/api/logger.js
0 → 100644
src/api/paginate.js
0 → 100644
Please register or sign in to comment