Skip to content

RealUnit referral-admin operator UI - #1452

Merged
TaprootFreak merged 7 commits into
developfrom
realunit-referral-admin
Sep 7, 2026
Merged

RealUnit referral-admin operator UI#1452
TaprootFreak merged 7 commits into
developfrom
realunit-referral-admin

Conversation

@TaprootFreakAI

Copy link
Copy Markdown
Collaborator

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 → list
  • PUT /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 / RealUnitManualReviewStatus enums (Date fields as ISO strings).
  • src/hooks/realunit-referral.hook.tsuseRealunitReferral() over useGuardedApi (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 a ConfirmationOverlay with a required reason.

Wired

  • src/App.tsx — lazy imports + routes /realunit/referral and /realunit/referral/:id.
  • src/screens/realunit.screen.tsx — a "RealUnit Referral" nav button next to Support/Compliance.
  • src/translations/languages/{de,fr,it}.json — new screens/referral namespace.

Action gating (mirrors the backend state machine)

  • Approve / Reject: reviewStatus === 'Pending' and not yet credited.
  • Award manual prize: 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).

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.
@TaprootFreakAI
TaprootFreakAI marked this pull request as ready for review September 6, 2026 10:33
@github-actions github-actions Bot added the ci Run PR CI on this draft label Sep 6, 2026
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.
@TaprootFreakAI

Copy link
Copy Markdown
Collaborator Author

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
  • Reviews: two parallel read-only lanes (conformity + logic), iterated to STATUS: complete / 0 findings at head e48f766.
  • CI (this head): Build and test, review, CodeQL, Build handbook image, Analyze — all green.
  • Tests: new unit tests for the hook (100%) and both screens (100% line/function); 22 tests covering action gating, the required-reason guard, approve/reject/manual-prize flows, optional-field/history rendering, filter, navigation, empty/error/not-found; dto enum values pinned.
  • Wiring: routes /realunit/referral + /realunit/referral/:id (App.tsx), e2e route claims + REALUNIT_ROUTES, handbook metadata entry, screens/referral i18n in de/fr/it. Follows the existing RealUnit admin (compliance/support/quotes) conventions.
  • Comments/threads: none open. Mergeable: yes.

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.

TaprootFreakAI and others added 2 commits September 6, 2026 14:47
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.
@TaprootFreak TaprootFreak added the ci:full Force the full test and e2e suites on this PR label Sep 7, 2026
@TaprootFreak
TaprootFreak merged commit 8325bea into develop Sep 7, 2026
13 checks passed
@TaprootFreak
TaprootFreak deleted the realunit-referral-admin branch September 7, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:full Force the full test and e2e suites on this PR ci Run PR CI on this draft

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants