Add balance adjustments (M8)
- New balance_adjustments table with CRUD store, sync logging, and service methods
- SQL migrations restructured: embed fs.FS from internal/store/migrations/, apply in order via user_version
- WeekService.Balance combines closed-weeks delta + adjustments delta; BalanceSummary breakdown
- Four REST routes: GET/POST /api/balance/adjustments, PUT/DELETE /api/balance/adjustments/{id}
- Dexie schema v2 + sync apply cases for balance_adjustments
- API client: BalanceAdjustment type, balance namespace (list/create/update/delete)
- utils: composeDeltaMs / decomposeDeltaMs helpers + 8 new Vitest tests (19 total, all passing)
- History page: balance card breakdown line + full adjustments section with inline add/edit/delete
This commit is contained in:
14
internal/store/migrations/002_balance_adjustments.sql
Normal file
14
internal/store/migrations/002_balance_adjustments.sql
Normal file
@@ -0,0 +1,14 @@
|
||||
-- +migrate Up
|
||||
CREATE TABLE balance_adjustments (
|
||||
id TEXT PRIMARY KEY,
|
||||
delta_ms INTEGER NOT NULL,
|
||||
note TEXT NOT NULL DEFAULT '',
|
||||
effective_at INTEGER NOT NULL,
|
||||
created_at INTEGER NOT NULL,
|
||||
updated_at INTEGER NOT NULL
|
||||
);
|
||||
CREATE INDEX idx_balance_adjustments_effective_at ON balance_adjustments(effective_at);
|
||||
|
||||
-- +migrate Down
|
||||
DROP INDEX IF EXISTS idx_balance_adjustments_effective_at;
|
||||
DROP TABLE IF EXISTS balance_adjustments;
|
||||
Reference in New Issue
Block a user