Files
SkyMoney/docs/api-phase5-move-log.md
Ricearoni1245 020d55a77e
All checks were successful
Deploy / deploy (push) Successful in 1m31s
Security Tests / security-non-db (push) Successful in 21s
Security Tests / security-db (push) Successful in 26s
phase 5: fixed expense logic simplified and compacted
2026-03-17 20:28:08 -05:00

6.1 KiB

API Phase 5 Move Log

Date: 2026-03-17
Scope: Move fixed-plans endpoints out of api/src/server.ts into a dedicated route module.

Route Registration Changes

  • Added fixed-plans route import in server.ts
  • Registered fixed-plans routes in server.ts
  • New canonical route module: fixed-plans.ts
  • Removed inline fixed-plans route blocks from server.ts to avoid duplicate registration:
    • PATCH /fixed-plans/:id/early-funding
    • POST /fixed-plans/:id/attempt-final-funding
    • PATCH /fixed-plans/:id/mark-unpaid
    • POST /fixed-plans/:id/fund-from-available
    • POST /fixed-plans/:id/catch-up-funding
    • POST /fixed-plans
    • PATCH /fixed-plans/:id
    • DELETE /fixed-plans/:id
    • POST /fixed-plans/:id/true-up-actual
    • GET /fixed-plans/due
    • POST /fixed-plans/:id/pay-now

Endpoint Movements

  1. PATCH /fixed-plans/:id/early-funding
  1. POST /fixed-plans/:id/attempt-final-funding
  1. PATCH /fixed-plans/:id/mark-unpaid
  1. POST /fixed-plans/:id/fund-from-available
  1. POST /fixed-plans/:id/catch-up-funding
  1. POST /fixed-plans
  1. PATCH /fixed-plans/:id
  1. DELETE /fixed-plans/:id
  1. POST /fixed-plans/:id/true-up-actual
  1. GET /fixed-plans/due
  1. POST /fixed-plans/:id/pay-now

Helper Ownership in Phase 5

  • Shared helper injection from server.ts:
    • mutationRateLimit
    • computeDepositShares
    • computeWithdrawShares
    • calculateNextDueDate
    • toBig
  • Route-local helper:
    • DAY_MS constant for date-window computations
    • PlanBody / PlanAmountMode zod schemas

Verification

  1. Build
  • cd api && npm run build
  1. Focused tests
  • cd api && npm run test -- tests/fixed-plans.estimated-true-up.test.ts tests/payment-rollover.test.ts tests/transactions.test.ts
  • Result: blocked by local DB connectivity (127.0.0.1:5432 unavailable), suites skipped/failed before endpoint assertions.