# Tasks Design: `design.md` (technical contracts) and `docs/superpowers/specs/2026-12-01-qr-self-registration-design.md` (product). Waves: - Wave 0 (serial, controller): 1.1 and 1.2 touch hotspots (SQL, seed, `package.json`). - Wave 1 (parallel, 3 implementers): 2.1, 3.1 and 4.1 build against the fixed contracts in design decisions 2 to 4. Each touches one module only. - Wave 2 (serial): 5.1, the portal, which also touches the middleware (security). - Wave 3 (serial, controller): 6.1. ## 1. Data and dependency - [x] 1.1 SQL `sql/01`, `02`, `99`; mirror 01 and 02 in `local/seed/03-colite.sql`; apply 01 and 02 to the local database. - Depends on: none - Scope: `local/seed/**`, `openspec/changes/add-qr-self-registration/sql/**` - Verify: `SELECT` shows the table, the new `event_lead` columns, and one notice per company with the company name filled in. - [x] 1.2 Portal: add `qrcode.react` (same major as babyboo's portal). - Depends on: none - Scope: `solvway-admin-portal/package.json`, `solvway-admin-portal/package-lock.json` - Verify: `cd solvway-admin-portal && npm run lint && npx tsc --noEmit && npx vitest run` ## 2. services-counter - [x] 2.1 Registration links and the registration capture (decision 2). - Tests first: - `ensure` creates the event code and missing personal codes once, keeps order, and makes 22-character unique tokens; - `setEnabled` refuses another company's or another event's token; - `findByToken` returns the link, or 404; - `mine` lists only enabled, not-ended events where the user is on the team, creating missing links; - `register`: - new person → NEW, OPEN, QR, `qr`, consent fields, interests, history null → OPEN by `qr`; - known by mobile → EXISTING, lead unchanged, notes list only differing submitted values (null when none); - mobile beats email when they match different leads; - newest lead wins among several; - already captured: unassigned + salesperson → ASSIGNED; otherwise ALREADY_CAPTURED with nothing changed; - the unique-key race → treated as already captured; - staff capture still sets `source STAFF`. - Scope: `solvway-services-counter/src/**` - Verify: `mvn -T 1C -q -pl solvway-services-counter verify` ## 3. services-system - [x] 3.1 Company privacy notice versions (decision 3). - Tests first: - GET returns the newest version, 404 when none; - POST adds a version, keeps older ones, trims, requires both texts, at most 5000 characters each, 404 for an unknown company. - Scope: `solvway-services-system/src/**` - Verify: `mvn -T 1C -q -pl solvway-services-system verify` ## 4. mobile-api - [x] 4.1 Public registration endpoints and the admin link and notice endpoints (decision 4). - Tests first: - **GET code checks:** inactive for each failing condition (unknown, switched off, event disabled, ended, company inactive, no notice); the active payload includes only active interests; - **POST rejections:** honeypot → 200 and no counter call; consent missing → 400 `CONSENT_REQUIRED` on field `consent`; - **POST validation:** same field rules as staff capture; an inactive interest is refused; - **POST salesperson:** the code's salesperson is passed when active on the team, null otherwise; - **POST notice:** the current notice id comes from the server; - **Limits:** 120 page loads per IP and 60 submissions per IP per event per 10 minutes → 429 `TOO_MANY` (Redis mocked); the IP comes from `HttpReqRespUtils.getClientIpAddressIfServletRequestExist`; - **Admin:** links endpoint scoped by company and gated `BO_EVENTS`; toggle; my links for the caller only and `[]` without a company; privacy notice GET/PUT super-admin only (403 for staff). - Scope: `solvway-mobile-api/src/**` - Verify: `mvn -T 1C -q -pl solvway-mobile-api verify` - [ ] 4.2 Gateway access for the public flow (decision 6), found by the live check. - Depends on: 4.1 - Tests first: - gateway: each decision-6 path passes without a user token for its method; POST `/company/1/privacyNotice`, GET `/user/findById/1`, POST `/counter/registrationLink/ensure` and a path with an extra segment still get 401; - services-system: `activeAdminOf` is true only for an enabled type-A user of that company, false otherwise and for an unknown user; - mobile-api: the public salesperson check uses `activeAdminOf` and never `findById`. - Scope: `solvway-api-gateway/src/**`, `solvway-services-system/src/**`, `solvway-mobile-api/src/**` - Verify: `mvn -T 1C -q -pl solvway-api-gateway,solvway-services-system,solvway-mobile-api verify` ## 5. Portal - [ ] 5.1 Public page, proxy, middleware, event QR card, My QR codes, Companies privacy notice (decision 5). - Depends on: 1.2 and the contracts of 4.1 - Tests first: - middleware: `/r/x` and `/api/public/registration/x` pass signed out, and `/events` still redirects; - proxy forwards GET and POST with the client IP; - public page: inactive message, the form with both notice texts, required consent, field errors, too-many, thank-you with "Register another person" resetting the form, honeypot field hidden from people and from assistive technology; - event QR card: codes, copy, switch (hidden without write access), download; - My QR codes: list and empty state; - Companies notice editor: super admin only, save, error; - the hard-coded copy sweep stays green. - Scope: `solvway-admin-portal/app/**`, `solvway-admin-portal/middleware.ts`, `solvway-admin-portal/middleware*.test.ts` - Verify: `cd solvway-admin-portal && npm run lint && npx tsc --noEmit && npx vitest run` ## 6. Release - [ ] 6.1 `docs/deployment.md` (SQL, notice review, the Traefik `X-Forwarded-For` note, dynamic-qr usage); live check on the local stack; Playwright at 1280 and 360 px: - a visitor registers through an event code and a personal code; - the inactive, consent and too-many paths; - staff toggle a code and see My QR codes; - a super admin edits a notice. - Depends on: 1.1 to 5.1 - Scope: `docs/deployment.md`, `openspec/changes/add-qr-self-registration/tasks.md` - Verify: the three Maven modules and the portal verify.