RealUnit referral-admin operator UI - #1452
Conversation
Add a RealUnit Referral admin screen to the operator dashboard for the referral/ promo backend endpoints: list referral relations with a held-for-review filter, a detail view with the review/reward history, and approve / reject / manual-prize actions (each requiring a reason). Wired through useGuardedApi + useRealunitGuard, routed under /realunit/referral, with de/fr/it strings.
Address review: reset the loaded relation at the top of the id-change effect so the loading/not-found guards work on an in-SPA id switch, and add getRelations to the effect deps (matching the realunit-compliance-user single-fetch sibling).
Address review conformity: add the /realunit/referral and /realunit/referral/:id route claims to the e2e registry and a RealUnit Referral entry to the handbook metadata, matching the existing realunit admin screens.
Add unit tests for the referral-admin UI: the hook's four operator calls, the list screen (held-for-review filter, count, navigation, empty + load-error states), the detail screen (action gating, required-reason guard, approve/reject/manual-prize flows, optional-field/history rendering, cancel, back, not-found, load error), and the dto enum values. Hook 100%, screens 100% line/function coverage.
Add /realunit/referral and /realunit/referral/:id to REALUNIT_ROUTES so the full-stack route-guard spec visits them, satisfying the e2e registry claim.
|
EN. Ready after two cross-vendor review passes reached zero findings, with the full effective CI green (Build and test, review, CodeQL, handbook, Analyze). Adds the RealUnit Referral operator screen to the admin dashboard — list referral relations with a held-for-review filter, a detail view with the review/reward history, and approve / reject / manual-prize actions, each requiring a reason. DE. Bereit, nachdem zwei Cross-Vendor-Review-Durchläufe null Findings erreicht haben und die vollständige wirksame CI grün ist (Build and test, review, CodeQL, Handbook, Analyze). Fügt dem Admin-Dashboard den RealUnit-Referral-Operator-Screen hinzu — Referral-Beziehungen mit Filter „nur zu prüfende", Detailansicht mit Prüf-/Auszahlungsverlauf und Aktionen Genehmigen/Ablehnen/Manuelle Prämie, jeweils mit Begründung. Gate evidence & scope
Deferred follow-up: the Playwright visual baseline for the new screen depends on the referral backend endpoints existing in the e2e stack (DFXswiss/backend#5290), so it is added once that lands — the e2e route claim and handbook metadata are already in place for it. |
Add e2e/realunit-referral.spec.ts (mirroring realunit-compliance.spec.ts): real admin auth, the referral-admin relations endpoint mocked with synthetic fixtures, screenshotting the held-for-review list and a relation detail with review actions. Baseline PNGs are generated separately on the macOS visual runner.
EN. Adds a RealUnit Referral admin screen to the operator dashboard for the referral/promo backend endpoints. Operators can list referral relations (with a "held for review" filter), open a relation to see its review/reward history, and approve, reject, or award a manual prize — each requiring a reason. Pairs with the RealUnit referral/promo backend (DFXswiss/backend#5290); the client sends only a reason, the actor is derived server-side from the JWT.
DE. Fügt dem Operator-Dashboard einen RealUnit-Referral-Admin-Screen für die Referral-/Promo-Backend-Endpoints hinzu. Operatoren können Referral-Beziehungen auflisten (Filter „nur zu prüfende"), eine Beziehung mit ihrem Prüf-/Auszahlungsverlauf öffnen und genehmigen, ablehnen oder eine manuelle Prämie auszahlen — jeweils mit Begründung. Passt zum RealUnit-Referral-/Promo-Backend (DFXswiss/backend#5290); der Client sendet nur eine Begründung, die Akteur-Identität kommt serverseitig aus dem JWT.
Scope & implementation
Endpoints (RoleGuard REALUNIT, via
useGuardedApi)GET /v1/realunit/referral/admin/relations→ listPUT /v1/realunit/referral/admin/relations/:id/approve(body{ reason })PUT /v1/realunit/referral/admin/relations/:id/reject(body{ reason })POST /v1/realunit/referral/admin/relations/:id/manual-prize(body{ reason })Added
src/dto/realunit-referral.dto.ts— relation type +RealUnitCodeKind/RealUnitManualReviewStatusenums (Date fields as ISO strings).src/hooks/realunit-referral.hook.ts—useRealunitReferral()overuseGuardedApi(staff 2FA / KYC redirects).src/screens/realunit-referral.screen.tsx— list with a held-for-review (Pending) filter, row → detail.src/screens/realunit-referral-detail.screen.tsx— key/value detail + review/reward history + approve/reject/manual-prize, each behind aConfirmationOverlaywith a required reason.Wired
src/App.tsx— lazy imports + routes/realunit/referraland/realunit/referral/:id.src/screens/realunit.screen.tsx— a "RealUnit Referral" nav button next to Support/Compliance.src/translations/languages/{de,fr,it}.json— newscreens/referralnamespace.Action gating (mirrors the backend state machine)
reviewStatus === 'Pending'and not yet credited.reviewStatus === 'Approved'and not yet credited.Note
DFXswiss/backend#5290 exposes no audit-list route, so the detail view renders the inline review/reward fields (
reviewedBy/At/Reason,manualRewardedBy/At/Reason) as the history. A full audit trail would need a new backend endpoint (out of scope here).