mirror of
https://github.com/Komediruzecki/token-circles.git
synced 2026-10-20 09:46:43 +02:00
Recurring transactions can now link accounts, so populating one moves balances — including a real two-legged Transfer (From account -> To account) as a scheduled standing order. Optional: a recurring with no account stays a pure reminder. - DB: add transfer_account_id to recurring_transactions (worker migration 0018 + backend schema). Nullable; existing rows keep NULL. - Form (RecurringSection): a "From account" selector for every type + a "To account" selector shown only for Transfer; sends account_id / transfer_account_id. - Populate (worker + backend + serverless): balance logic mirrors the serverless computeBalanceDeltas exactly — income/expense move one account; a transfer with both legs moves From -> To; a transfer missing a leg makes NO change (money can't vanish); an account-less recurring is a reminder. - Serverless populate now also updates balances (it previously did nothing) and gained the worker's 409 idempotency guard + all-frequency next_date advance, so all three modes agree. - account_id / transfer_account_id are ownership-validated on create/update (403). Tests (all run locally): - backend recurring-bills-balance.spec: two-legged transfer conserves (1000/500 -> 800/700); a foreign transfer_account_id is rejected (403). Full backend suite 468. - worker recurring-bills-balance.test: two-legged transfer + IDOR (run with `pnpm -C worker test`; full worker suite passes). - frontend localHandlers.recurring.test: serverless income / two-legged transfer / idempotency / account-less reminder. Full frontend suite 429; typecheck + lint clean.