Skip to content

web: settings profile - preferred currency and default alert days #227

Description

@rghvgrv

Parent

#196 — PRD: Angular web client for SubVora (parity minus reminders)

What to build

The settings screen's profile card: the signed-in email (read-only), the preferred (home) currency, and the default alert days that per-subscription alerts inherit. Changing the currency must invalidate the dashboard so totals refetch converted into the new home currency rather than sitting there wrong.

Implementation Steps

  1. API service — core/api/users-api.service.ts with getMe() and updateMe({ preferredCurrency, defaultAlertDaysAdvance }), both typed to UserProfile.
  2. Store — features/settings/settings.store.ts: profile signal, load(), saveProfile(); failures via the write-failure mapper.
  3. Screen — features/settings/settings.component.ts with a profile card: email shown but disabled, currency select over the ISO-4217 list from slice 6, default alert days (blank allowed, otherwise 1–365). Lazily-loaded /settings route behind authGuard, linked from the shell nav.
  4. Invalidate dependents — after a successful currency change, clear the dashboard store's cached burn rate so the next visit refetches; if the dashboard is the active screen, reload it immediately.
  5. Spec — settings.store.spec.ts: a save sends both fields and updates the profile signal; blank alert days is sent as null, not 0; a currency change invalidates the dashboard; a 400 maps onto the right control.

Agent Routing

agent_routing:
  complexity_hint: easy
  required_capability: balanced
  parallel_safe: true
  cost_preference: low
  speed_preference: balanced
  ownership_scope:
    - src/SubVora.Web/src/app/core/api/users-api.service.ts
    - src/SubVora.Web/src/app/features/settings/**
    - src/SubVora.Web/src/app/app.routes.ts
  verification:
    - cd src/SubVora.Web && npx ng test --no-watch

Technical Context Snapshot

Current stack in scope

  • UI: Angular (20+) standalone components with signals and built-in control flow, Angular Material (Material 3) as the only component library, SCSS. Static SPA — no SSR, no service worker.
  • State: signal-backed injectable stores, one per domain area, mirroring the MAUI ViewModel split in src/SubVora.Mobile/ViewModels one-to-one. No NgRx.
  • API access: hand-written models plus one service per API controller under src/SubVora.Web/src/app/core/api. Enums travel as JSON strings (JsonStringEnumConverter in Program.cs), so TypeScript string-literal unions are exact.
  • Backend consumed unchanged: ASP.NET Core net10.0, /api/v1/, JWT bearer in the Authorization header, tokens in JSON bodies (no cookies).
  • Tests: Angular CLI unit-test builder (Vitest runner; Karma is deprecated) with HttpTestingController. Stores, interceptors, mappers and utils only — no component-DOM or browser automation.

Dependencies in scope

  • Reuse: @angular/*, @angular/material, rxjs, and the utilities already added under src/SubVora.Web/src/app/core. No chart library, no date library, no HTTP wrapper library.
  • New dependency additions allowed for this slice: no. If a dependency looks unavoidable, stop and raise it on the issue rather than adding it.

Architecture alignment

  • Preserve the repo's load-bearing rules (CLAUDE.md): burn-rate maths is server-side and counts cycles, never days; currency conversion is a read-time projection and stored amounts are never overwritten; nothing advances next_billing_date on a timer; provider matching stays one SQL query; the mobile SQLite cache stays a read-only mirror.
  • There is deliberately no shared DTO project. Web models mirror the API's JSON contract by convention — a contract change means editing both sides.
  • create-git-issue provides routing hints only and assigns no concrete agent or model.
  • run-with-it remains the final runtime routing authority.

Integration touchpoints

  • Consumes GET and PUT /api/v1/users/me returning { id, email, preferredCurrency, defaultAlertDaysAdvance }.
  • Mirrors UpdateUserProfileRequestValidator: currency required, 3 characters, valid ISO-4217; default alert days null or 1-365.
  • The preferred currency is the home currency the server converts dashboard totals into, so changing it changes every total.
  • This default does not change any subscription's own alert_days_advance override.

Acceptance criteria

  • The profile loads and both fields save, with a blank alert-days field sent as null.
  • Changing the preferred currency causes dashboard totals to be refetched in the new currency.
  • Email is displayed but not editable, and validation mirrors the server's rules.

Blocked by

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestready-for-agentReady for autonomous agent execution

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions