feat(web): my tickets, QR, orders and profile (#42) #127

Merged
amiryahaya merged 18 commits from feat/42-my-tickets into main 2026-10-29 15:59:32 +01:00
Owner

What

Issue #42: the storefront's signed-in customer pages.

  • /tickets: tickets grouped by sale. Each sale shows the master QR or the individual QRs a visitor needs to enter, with a status per ticket (ready, not yet valid, expired, checked in/out, cancelled). Vehicle tickets are shown and labelled; the gate does not scan them yet (ADR 0019).
  • /orders: order history, linking to the existing /orders/:id.
  • /profile: read-only account details (no edit API exists).
  • API: GET /v1/me/tickets now returns activity_type (master|park_entry|vehicle) (OpenAPI, SQL, generated clients, live contract assertion).
  • API: new per-user rate-limit class read (120/min, burst 250) for GET /v1/me/tickets and .../{code}/qr, with the 429 in OpenAPI and ADR 0028. Burst 250 covers a 200-ticket sale (200 QRs + list + master).
  • Ticket codes are never in a URL, log, text or attribute; QR images are fetched with cache: "no-store" and the blob URL is created and revoked inside the component.
  • Tests: unit (345), mocked Playwright with a second sign-in-on build and mocked IdP, real-IdP journey (e2e:idp, decodes the QR with jsqr), and api/internal/sales/pgstore/qrflows_test.go for the 12 QR flows.

Reviews

Per-task reviews (7, all approved) and a whole-branch dual-pass review: Pass 1 ponytail (no Must fix), Pass 2 correctness (3 fix-before-merge items, all fixed and re-reviewed; burst 60 -> 250 after both passes flagged it).

Checks

  • make cover: 91.3% (minimum 80%)
  • make lint: 0 issues; make contract: ok
  • web typecheck (3 apps) ok; ticket unit tests 345/345
  • scripts/web-e2e.sh: 207 passed / 58 skipped, e2e:idp 8/8 (both run before the final commit, which changed only a rate-limit number, docs, a hoisted constant and comments)

The 12 QR flows

9 of 12 were already covered by existing Go tests; 3 added in qrflows_test.go. "Refunded" is covered through a late-paid cancelled sale.

Known / accepted gaps

  • Master stays checked_in if a child is never scanned.
  • Vehicle-only ticket sale gets a master with no children: page "Ready", gate nothing_to_scan.
  • Master with expired and not-yet-valid children shows Ready, gate returns ErrExpired.
  • Vehicle "Ready" sits next to the "gates do not scan this yet" note.
  • now is read once per render; all tickets of a sale show the buyer as holder name; no Nairobi-time note on check-in times.
  • No PDF/receipt download, wallet or offline QR yet.
  • Other API clients still get the 1-day QR cache header.
  • read class numbers are [verify] defaults (#61).
  • Signed-in header at 320 px wraps to more rows; .account-name link restyled.
  • build:e2e-auth hard-codes port 4174; e2e:idp is not in CI and leaves a completed sale per run.

Not verified

Real phones, Safari/Firefox, Zitadel, the Dart client (CI checks it).

🤖 Generated with Claude Code

## What Issue #42: the storefront's signed-in customer pages. - `/tickets`: tickets grouped by sale. Each sale shows the master QR or the individual QRs a visitor needs to enter, with a status per ticket (ready, not yet valid, expired, checked in/out, cancelled). Vehicle tickets are shown and labelled; the gate does not scan them yet (ADR 0019). - `/orders`: order history, linking to the existing `/orders/:id`. - `/profile`: read-only account details (no edit API exists). - API: `GET /v1/me/tickets` now returns `activity_type` (`master|park_entry|vehicle`) (OpenAPI, SQL, generated clients, live contract assertion). - API: new per-user rate-limit class `read` (120/min, burst 250) for `GET /v1/me/tickets` and `.../{code}/qr`, with the 429 in OpenAPI and ADR 0028. Burst 250 covers a 200-ticket sale (200 QRs + list + master). - Ticket codes are never in a URL, log, text or attribute; QR images are fetched with `cache: "no-store"` and the blob URL is created and revoked inside the component. - Tests: unit (345), mocked Playwright with a second sign-in-on build and mocked IdP, real-IdP journey (`e2e:idp`, decodes the QR with `jsqr`), and `api/internal/sales/pgstore/qrflows_test.go` for the 12 QR flows. ## Reviews Per-task reviews (7, all approved) and a whole-branch dual-pass review: Pass 1 ponytail (no Must fix), Pass 2 correctness (3 fix-before-merge items, all fixed and re-reviewed; burst 60 -> 250 after both passes flagged it). ## Checks - `make cover`: **91.3%** (minimum 80%) - `make lint`: 0 issues; `make contract`: ok - web typecheck (3 apps) ok; ticket unit tests 345/345 - `scripts/web-e2e.sh`: 207 passed / 58 skipped, `e2e:idp` 8/8 (both run before the final commit, which changed only a rate-limit number, docs, a hoisted constant and comments) ## The 12 QR flows 9 of 12 were already covered by existing Go tests; 3 added in `qrflows_test.go`. "Refunded" is covered through a late-paid cancelled sale. ## Known / accepted gaps - Master stays `checked_in` if a child is never scanned. - Vehicle-only ticket sale gets a master with no children: page "Ready", gate `nothing_to_scan`. - Master with expired and not-yet-valid children shows Ready, gate returns `ErrExpired`. - Vehicle "Ready" sits next to the "gates do not scan this yet" note. - `now` is read once per render; all tickets of a sale show the buyer as holder name; no Nairobi-time note on check-in times. - No PDF/receipt download, wallet or offline QR yet. - Other API clients still get the 1-day QR cache header. - `read` class numbers are [verify] defaults (#61). - Signed-in header at 320 px wraps to more rows; `.account-name` link restyled. - `build:e2e-auth` hard-codes port 4174; `e2e:idp` is not in CI and leaves a completed sale per run. ## Not verified Real phones, Safari/Firefox, Zitadel, the Dart client (CI checks it). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
GET /v1/me/tickets items carry activity_type (master, park_entry or
vehicle) so a page can tell a car's QR from a person's. master stays.

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>
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>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Second preview build with sign-in on and a mocked same-origin IdP (auth-* projects, *.auth.spec.ts);
header wraps on phones when signed in.

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>
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>
fix: read burst fits a 200-ticket sale and tidy-ups (#42)
All checks were successful
ci / changes (pull_request) Successful in 30s
ci / clients (pull_request) Successful in 2m10s
ci / web (pull_request) Successful in 4m21s
ci / api (pull_request) Successful in 8m40s
ci / ci-gate (pull_request) Successful in 1s
6fa71a0136
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!127
No description provided.