feat(currency): per-user allowlist of currencies in the amount pickers - #19
Open
sebastianiv21 wants to merge 2 commits into
Open
feat(currency): per-user allowlist of currencies in the amount pickers#19sebastianiv21 wants to merge 2 commits into
sebastianiv21 wants to merge 2 commits into
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
# 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10.
Users can now choose which currencies the amount pickers offer, instead of the hardcoded
USD/COPpair.What changed
Data —
financial_profile.supported_currencies varchar(3)[], NOT NULL, defaultARRAY['USD']. Migration0005_warm_rick_jones.sqlis the generatedADD COLUMNplus a hand-written backfill: base currency first, then the distinct codes the user has actually used acrosstransactionsandrecurring_transactions, capped at 7 extras so backfilled rows satisfy the max-8 validator.Validation —
supportedCurrenciesSchema(1–8 entries, distinct, each refined againstSUPPORTED_CURRENCIES) on both the create and update schemas. Create refines that the base currency is a member. Because the update payload is partial,updateFinancialProfilere-checks that rule against the row merged with the payload and returnsActionResultrather than throwing.Client —
CurrencyProvidercarriessupported: 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 fromCurrencySelectorasCurrencyOptionListand is shared by both. The profile page shows the list read-only; onboarding sends[chosen base currency].Docs —
docs/DATA_MODEL.mdgains the currency columns onfinancial_profile,transactions, andrecurring_transactions, plus theexchange_rate_cachetable, none of which were documented.Verification
From
web/:pnpm typecheckclean,pnpm lint0 errors (7 pre-existing warnings),pnpm test157 passed (4 new allowlist cases),pnpm buildsucceeded.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