Skip to content

feat(currency): per-user allowlist of currencies in the amount pickers - #19

Open
sebastianiv21 wants to merge 2 commits into
mainfrom
feat/currency-allowlist
Open

feat(currency): per-user allowlist of currencies in the amount pickers#19
sebastianiv21 wants to merge 2 commits into
mainfrom
feat/currency-allowlist

Conversation

@sebastianiv21

Copy link
Copy Markdown
Owner

Closes #10.

Users can now choose which currencies the amount pickers offer, instead of the hardcoded USD / COP pair.

What changed

Datafinancial_profile.supported_currencies varchar(3)[], NOT NULL, default ARRAY['USD']. Migration 0005_warm_rick_jones.sql is the generated ADD COLUMN plus a hand-written backfill: base currency first, then the distinct codes the user has actually used across transactions and recurring_transactions, capped at 7 extras so backfilled rows satisfy the max-8 validator.

ValidationsupportedCurrenciesSchema (1–8 entries, distinct, each refined against SUPPORTED_CURRENCIES) on both the create and update schemas. Create refines that the base currency is a member. Because the update payload is partial, updateFinancialProfile re-checks that rule against the row merged with the payload and returns ActionResult rather than throwing.

ClientCurrencyProvider carries supported: string[]; both amount pickers map over it. A form holding a currency the user has since removed keeps that code in its list, so editing an old transaction can't silently rewrite its currency.

Profile UI — chip-row editor in the profile sheet (components/currency-allowlist.tsx); the base-currency chip has no remove button, and switching the base auto-adds it to the list. The catalogue list was extracted from CurrencySelector as CurrencyOptionList and is shared by both. The profile page shows the list read-only; onboarding sends [chosen base currency].

Docsdocs/DATA_MODEL.md gains the currency columns on financial_profile, transactions, and recurring_transactions, plus the exchange_rate_cache table, none of which were documented.

Verification

From web/: pnpm typecheck clean, pnpm lint 0 errors (7 pre-existing warnings), pnpm test 157 passed (4 new allowlist cases), pnpm build succeeded.

Migration applied to the Neon dev database; the 4 existing profiles backfilled to ['USD'], ['COP','USD'], ['USD','COP'], ['USD','COP'].

Not done: manual pass over the picker at 1, 2, and 8 enabled currencies, and no review council was run.

🤖 Generated with Claude Code

The transaction and recurring amount pickers offered a hardcoded USD / COP
pair, so a user on any other base currency could not log in their own money
without editing code.

Store the shortlist as financial_profile.supported_currencies (1-8 distinct
codes from SUPPORTED_CURRENCIES, always containing the base currency), expose
it through CurrencyProvider, and edit it from the profile sheet as a chip row.

The 0005 migration backfills existing rows with the base currency followed by
every code they have actually used across transactions and recurring items, so
nobody lands on an empty picker.

Closes #10

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
intent-expense-tracker Ready Ready Preview Aug 14, 2026 3:57am

# Conflicts:
#	web/components/currency-provider.tsx
#	web/components/currency-selector.tsx
#	web/components/financial-profile-sheet.tsx
#	web/components/recurring-page.tsx
#	web/components/transaction-sheet.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Profile config: per-user allowlist of currencies available in the amount pickers

1 participant