update money tracker
All checks were successful
Test and deploy staging / staging (push) Successful in 30s

This commit is contained in:
2026-09-23 18:06:20 +00:00
parent 2466db74cd
commit 499dd94cbb
9 changed files with 641 additions and 77 deletions

View File

@@ -11,6 +11,7 @@ export const moneyAccounts = pgTable(
.references(() => user.id, { onDelete: 'cascade' }),
name: text('name').notNull(),
openingBalanceCents: integer('opening_balance_cents').notNull().default(0),
kind: text('kind').notNull().default('spendable'),
...timestamps
},
(table) => [unique().on(table.userId, table.name), index().on(table.userId)]
@@ -44,6 +45,8 @@ export const moneyRecurring = pgTable(
name: text('name').notNull(),
amountCents: integer('amount_cents').notNull(),
cadence: text('cadence').notNull(),
startsOn: date('starts_on', { mode: 'string' }),
endsOn: date('ends_on', { mode: 'string' }),
accountId: integer('account_id').references(() => moneyAccounts.id, { onDelete: 'set null' }),
...timestamps
},
@@ -106,12 +109,36 @@ export const moneyWishlist = pgTable(
.references(() => user.id, { onDelete: 'cascade' }),
name: text('name').notNull(),
estimatedCents: integer('estimated_cents'),
priority: integer('priority').notNull().default(3),
notes: text('notes'),
...timestamps
},
(table) => [index().on(table.userId)]
);
export const moneyProjectionSettings = pgTable(
'money_projection_settings',
{
id: id(),
userId: text('user_id')
.notNull()
.references(() => user.id, { onDelete: 'cascade' }),
investmentAccountId: integer('investment_account_id').references(() => moneyAccounts.id, {
onDelete: 'set null'
}),
reserveCents: integer('reserve_cents').notNull().default(100000),
annualReturnPercent: numeric('annual_return_percent', { precision: 5, scale: 2 })
.notNull()
.default('5.00'),
contributionMode: text('contribution_mode').notNull().default('excess'),
includeRecurring: integer('include_recurring').notNull().default(1),
fixedMonthlyCents: integer('fixed_monthly_cents').notNull().default(0),
endDate: date('end_date', { mode: 'string' }),
...timestamps
},
(table) => [unique().on(table.userId)]
);
export const moneyInsurances = pgTable(
'money_insurances',
{