feat(web): admin currencies, exchange rates and settings (#46 slice A) #132

Merged
amiryahaya merged 6 commits from feat/46-admin-finance-settings into main 2026-10-30 08:07:14 +01:00
Owner

What

Admin portal slice A of #46, for the finance team: Currencies (/currencies, admin_portal.administration.manage): list, create, edit (ledger account, GL code, default, active). Exchange rates (/rates, admin_portal.finance.manage): filters (from, to, active in the URL), offset paging, create, edit; the rate is an exact decimal string sent as typed (never parsed), windows entered in Nairobi time and sent as +03:00 instants. Settings (/settings, administration.manage): every known key with its value or "Not set", set, change, unset with a confirm step, plus a note that the finance exports leave an unset GL code empty. Web only; no Go or OpenAPI change. Shared api.ts and forms.ts helpers now also serve the organizations module (behaviour unchanged).

Reviews

Superpower Code Review, dual pass, per task and on the whole branch. After the final fix wave: Pass 1 (ponytail) Must fix empty; Pass 2 (correctness) Critical and Important empty. The whole-branch review found four Important bugs (rates filter lost on Apply, Reload then Save reverting another admin's untouched fields, duplicate currency code shown as a stale-version loop, settings dead ends on 409/404); all fixed with red-first tests.

Checks

  • make cover: 91.3% (minimum 80%), Go unchanged.
  • Web unit: ui 35, auth 45, ticket 303, admin 218. Typecheck and build clean.
  • scripts/web-e2e.sh: admin 101 passed / 1 skipped (68 + 33 new), ticket 207 / 58 unchanged.

Rulings

  • The rate pickers use the public /v1/currencies (finance-only staff cannot call the admin list).
  • An update 409 on a rate is "overlap" only when the server's documented overlap sentence matches (compared, never shown); any other update 409 is the stale-version text. A create 409 is always overlap.
  • The duplicate-code and stale 409s are told apart the same way; a Reload after a stale 409 keeps the fields the user changed and takes the server's values for the rest.
  • Not in this PR: donations (no API yet), forms, countries/states/cities (slice B), rate delete, conversion preview.

Known limits

  • A deep-linked filter on an inactive currency shows "Any" and is dropped on Apply.
  • Two admins making different currencies the default at the same moment can see the duplicate-code message.
  • After a 404 and Reload, an open editor for a deleted row closes without a message.
  • The list 429 text is the shared "Too many requests" wording.
  • Not verified: real phones, Safari/Firefox, real IdP.

🤖 Generated with Claude Code

## What Admin portal slice A of #46, for the finance team: **Currencies** (`/currencies`, `admin_portal.administration.manage`): list, create, edit (ledger account, GL code, default, active). **Exchange rates** (`/rates`, `admin_portal.finance.manage`): filters (from, to, active in the URL), offset paging, create, edit; the rate is an exact decimal string sent as typed (never parsed), windows entered in Nairobi time and sent as `+03:00` instants. **Settings** (`/settings`, `administration.manage`): every known key with its value or "Not set", set, change, unset with a confirm step, plus a note that the finance exports leave an unset GL code empty. Web only; no Go or OpenAPI change. Shared `api.ts` and `forms.ts` helpers now also serve the organizations module (behaviour unchanged). ## Reviews Superpower Code Review, dual pass, per task and on the whole branch. After the final fix wave: Pass 1 (ponytail) Must fix empty; Pass 2 (correctness) Critical and Important empty. The whole-branch review found four Important bugs (rates filter lost on Apply, Reload then Save reverting another admin's untouched fields, duplicate currency code shown as a stale-version loop, settings dead ends on 409/404); all fixed with red-first tests. ## Checks - `make cover`: 91.3% (minimum 80%), Go unchanged. - Web unit: ui 35, auth 45, ticket 303, admin 218. Typecheck and build clean. - `scripts/web-e2e.sh`: admin 101 passed / 1 skipped (68 + 33 new), ticket 207 / 58 unchanged. ## Rulings - The rate pickers use the public `/v1/currencies` (finance-only staff cannot call the admin list). - An update 409 on a rate is "overlap" only when the server's documented overlap sentence matches (compared, never shown); any other update 409 is the stale-version text. A create 409 is always overlap. - The duplicate-code and stale 409s are told apart the same way; a Reload after a stale 409 keeps the fields the user changed and takes the server's values for the rest. - Not in this PR: donations (no API yet), forms, countries/states/cities (slice B), rate delete, conversion preview. ## Known limits - A deep-linked filter on an inactive currency shows "Any" and is dropped on Apply. - Two admins making different currencies the default at the same moment can see the duplicate-code message. - After a 404 and Reload, an open editor for a deleted row closes without a message. - The list 429 text is the shared "Too many requests" wording. - Not verified: real phones, Safari/Firefox, real IdP. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Also makes the checkbox targets 44 px in the admin content.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
fix(web): admin finance and settings review fixes (#46)
All checks were successful
ci / changes (pull_request) Successful in 21s
ci / api (pull_request) Has been skipped
ci / clients (pull_request) Has been skipped
ci / web (pull_request) Successful in 5m29s
ci / ci-gate (pull_request) Successful in 3s
a112481939
- Rates filter keeps a deep-linked from/to on Apply; filter ids must be uuids.
- Untouched fields follow the reloaded row after a stale 409 (currencies, rates);
  untouched rate window edges are sent as stored; the rate is trimmed.
- Duplicate currency code is a field error; 404 and a 409 on Set are stale with Reload.
- 422 naming no shown field falls back to the save-failed text.
- Forms close after the list refetch, a late answer closes only its own editor,
  focus moves to the form heading and back to the opener.
- Shared api.ts (Failure, NEVER, call, failureText, UUID) and forms.ts
  (describeFailure, useGuardedSubmit, useEditing) used by currencies, rates,
  settings and organizations; useSaveRate takes a union; unused menu keys removed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
primatekuntech/kws!132
No description provided.