feat(budget): make a settle-up payment's date editable

The settle-up form only exposed from/to/amount and silently dated the
payment by created_at, unlike a regular expense which has an editable
date. Add a settled_at column (independent of created_at, same split as
expense_date) through the schema, migration, service, REST and MCP
surfaces, and the desktop + mobile forms; the ledger groups a payment by
settled_at, falling back to created_at for rows recorded before the
column existed.
This commit is contained in:
RemEx
2026-09-11 15:04:51 +00:00
committed by Maurice
parent 76e182f44e
commit bd46089450
16 changed files with 200 additions and 36 deletions
+8
View File
@@ -221,6 +221,11 @@ export const budgetSettlementSchema = z.object({
currency: z.string().nullable().optional(),
exchange_rate: z.number().optional(),
created_at: z.string().optional(),
// The calendar day the transfer actually happened (YYYY-MM-DD), independent of
// `created_at` (when it was recorded) — same split as budget_items' expense_date
// vs. created_at. Null/absent on rows recorded before this column existed; the
// ledger falls back to `created_at`'s date for those.
settled_at: z.string().nullable().optional(),
created_by_user_id: z.number().nullable().optional(),
from_username: z.string().optional(),
from_avatar_url: z.string().nullable().optional(),
@@ -235,6 +240,8 @@ export const budgetCreateSettlementRequestSchema = z.object({
amount: z.number(),
// The display currency the amount was entered in; the server freezes its FX rate.
currency: z.string().nullable().optional(),
// The day the transfer happened; defaults to today (server-side) when omitted.
settled_at: z.string().nullable().optional(),
});
export type BudgetCreateSettlementRequest = z.infer<typeof budgetCreateSettlementRequestSchema>;
@@ -244,6 +251,7 @@ export const budgetUpdateSettlementRequestSchema = z.object({
to_user_id: z.number(),
amount: z.number(),
currency: z.string().nullable().optional(),
settled_at: z.string().nullable().optional(),
});
export type BudgetUpdateSettlementRequest = z.infer<typeof budgetUpdateSettlementRequestSchema>;