Skip to content

feat: default new users to INR instead of USD - #114

Merged
rghvgrv merged 1 commit into
mainfrom
feat/default-currency-inr
Aug 7, 2026
Merged

feat: default new users to INR instead of USD#114
rghvgrv merged 1 commit into
mainfrom
feat/default-currency-inr

Conversation

@rghvgrv

@rghvgrv rghvgrv commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

What

Makes INR the default currency across the app instead of USD.

Where Before After
User.PreferredCurrency (entity default) USD INR
users.preferred_currency (DB column default) USD INR
New-subscription currency in the mobile detail form USD INR
Currency Entry placeholders (subscription + settings pages) USD INR
docs/Design.md DDL 'USD' 'INR'

Existing users are not touched

The migration (DefaultPreferredCurrencyInr) alters the column default only — no UPDATE, no backfill. Anyone who already picked a currency keeps it. Changing a default should not overwrite a deliberate choice, so the Down migration is a clean inverse for the same reason.

Cleanup included

AuthService.RegisterAsync set PreferredCurrency = "USD" explicitly while the User entity initializer already carried the same default — two places stating one value. Removed the assignment; the entity default is now the single source. Registration behavior is unchanged.

No change needed in FxRateRefreshBackgroundService: it derives its base/target currency pairs from the rows actually in use, so it picks up INR without a code change.

Test changes

DashboardControllerTests.GetBurnRate_WithActiveMonthlySubscription_ReturnsCorrectTotals and SubscriptionsControllerTests (via ValidRequest()) created USD subscriptions. Those tests passed because the subscription currency happened to equal the old USD home currency, so the burn-rate calculator never converted. With an INR home currency they would need a live USD -> INR rate that the Testcontainers-backed run has no way to fetch. Both now use INR, which keeps them testing burn-rate math rather than FX plumbing. Mixed-currency conversion stays covered by BurnRateCalculatorTests, which stubs rates.

UsersControllerTests now asserts INR as the registration default — that assertion is the check on this change.

Verification

All four test projects pass locally:

SubVora.Api.Tests             105 passed
SubVora.Application.Tests      28 passed
SubVora.Infrastructure.Tests   98 passed
SubVora.Mobile.Tests          100 passed

Notes for the reviewer

  • Deployed databases need dotnet ef database update (the db-migrate workflow) — the default only applies to rows inserted after it runs.
  • Currency is still a free-text 3-character Entry on both mobile pages. A picker would prevent typos but is out of scope here.

Changes the default home currency for new accounts, the default currency on
a newly created subscription in the mobile client, and the currency Entry
placeholders. Existing accounts are untouched.

The migration alters the users.preferred_currency column default only — it
does not backfill. A default change should not silently overwrite a currency
a user deliberately chose.

Drops the redundant PreferredCurrency assignment in AuthService: the User
entity initializer already carries the default, so registration had two
places stating the same value.

Two burn-rate integration tests created USD subscriptions and happened to
match the old USD home currency, so no FX conversion ran. With the new
default they would need a live USD->INR rate the test container cannot
fetch. Switched them to INR so they keep testing burn-rate math.
@rghvgrv rghvgrv self-assigned this Aug 7, 2026
@rghvgrv
rghvgrv merged commit 57e8ef7 into main Aug 7, 2026
2 checks passed
@rghvgrv
rghvgrv deleted the feat/default-currency-inr branch August 7, 2026 09:01
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.

1 participant