Files
SkyMoney/docs/api-phase3-move-log.md
Ricearoni1245 4a63309153
All checks were successful
Deploy / deploy (push) Successful in 1m33s
Security Tests / security-non-db (push) Successful in 20s
Security Tests / security-db (push) Successful in 26s
phase 3: all variable cateogry references simplified
2026-03-16 15:20:12 -05:00

3.9 KiB

API Phase 3 Move Log

Date: 2026-03-16
Scope: Move variable-categories endpoints out of api/src/server.ts into a dedicated route module.

Route Registration Changes

  • Added variable-categories route import in server.ts
  • Registered variable-categories routes in server.ts
  • New canonical route module: variable-categories.ts
  • Removed inline variable-categories route block from server.ts to avoid duplicate endpoint registration.

Endpoint Movements

  1. POST /variable-categories
  1. PATCH /variable-categories/:id
  1. DELETE /variable-categories/:id
  1. POST /variable-categories/rebalance
  1. GET /variable-categories/manual-rebalance
  1. POST /variable-categories/manual-rebalance

Helper Ownership in Phase 3

  • Kept variable-category-specific helpers local to the route module:
    • assertPercentTotal
    • getLatestBudgetSession
    • ensureBudgetSession
    • ensureBudgetSessionAvailableSynced
  • Reused shared server helper by injection:
    • computeDepositShares injected from server.ts registration.
  • Reused shared mutation throttling by injection:
    • mutationRateLimit injected from server.ts registration.

Follow-ups To Revisit

  1. Consolidate budget-session sync helpers into a shared service (api/src/services/budget-session.ts) once Phase 4 starts.
  2. Standardize response error envelopes for variable-category routes (message vs ok/code/message) to reduce client branching.
  3. Recheck variable-categories.manual-rebalance.test.ts over-80 error-code expectation versus current confirm-style behavior to keep tests aligned with product policy.