Files
co-lite/openspec/changes/archive/2026-12-04-add-event-tickets/tasks.md
T

8.0 KiB

Tasks

Design: design.md (technical contracts) and docs/superpowers/specs/2026-12-04-event-ticketing-design.md (product).

Mode: all tasks run serially in the main session (the owner asked for no worker subagents). Each task starts with failing tests (TDD).

1. Data

  • 1.1 Write the SQL:

    • sql/01-ticket-attendees.sql: the three ticket columns, the two keys, and codes for active tickets on Paid orders that have none;
    • sql/99-rollback.sql.

    Mirror 01 in local/seed/03-colite.sql and apply it to the local database.

    • Depends on: none
    • Scope: local/seed/**, openspec/changes/add-event-tickets/sql/**
    • Verify: SHOW CREATE TABLE ticket shows the columns and keys; local Paid tickets have 22-character codes.

2. services-counter

  • 2.1 Ticket codes, ticket state and the ticket lookups.
    • Depends on: 1.1
    • Tests first:
      • Codes:
        • a free order's tickets get codes at creation;
        • mark paid (from Awaiting payment and from Expired) gives each active ticket a distinct 22-character code;
        • an Awaiting-payment order has none.
      • TicketState.of: valid, checked in, awaiting, order cancelled, order expired and ticket cancelled.
      • ticket/byCode:
        • returns the event, type, attendee first name, state and check-in time;
        • never returns mobile, email or buyer details;
        • an unknown code is 404 TICKET_NOT_FOUND.
      • byToken: lists tickets (id, type, attendee name, code, state) only when Paid, without contacts.
    • Scope: solvway-services-counter/src/**
    • Verify: mvn -T 1C -q -pl solvway-services-counter verify
  • 2.2 Naming attendees, consent and ticket emails.
    • Depends on: 2.1
    • Tests first:
      • Naming:
        • refused without permission, when the order is not Paid, when the ticket is cancelled, and when it is checked in (ALREADY_CHECKED_IN);
        • an unknown token or a ticket of another order is 404;
        • a save sets a new code and attendee_named_at, and clears consent and the lead link.
      • Consent:
        • refused on an invalid or unnamed ticket;
        • calls registration with source TICKET, the notice and no salesperson, and stores consent time, notice id and lead uuid.
      • Mailer:
        • PAID lists every active ticket with its QR <img> URL, its link and the "Name your attendees" link;
        • TICKET goes to the attendee's email;
        • naming with only a mobile sends nothing.
      • Resend ticket: goes to the attendee's email, else the buyer; refused for an invalid ticket.
    • Scope: solvway-services-counter/src/**
    • Verify: mvn -T 1C -q -pl solvway-services-counter verify
  • 2.3 Door check-in, self check-in rules and the counts.
    • Depends on: 2.2
    • Tests first:
      • Staff check-in:
        • records the time and user;
        • a second check-in gives ALREADY_CHECKED_IN|<time>;
        • each invalid state gives NOT_VALID|<state>;
        • outside the event days gives NOT_EVENT_DAY;
        • an unnamed ticket needs a name and contact;
        • consent creates the lead and marks it attended;
        • another company's ticket is 404.
      • Self check-in on a ticketed event:
        • a named attendee's ticket is checked in;
        • an unnamed ticket matches its buyer, oldest first;
        • a registered guest still works;
        • anything else gives SHOW_TICKET;
        • walk-in register is refused with TICKETS_ONLY.
        • On an event without tickets, the old results are unchanged.
      • Headcount: tickets awaiting, paid and checked in, counting active tickets only.
    • Scope: solvway-services-counter/src/**
    • Verify: mvn -T 1C -q -pl solvway-services-counter verify

3. mobile-api and gateway

  • 3.1 Public ticket endpoints, the QR PNG and gateway paths.
    • Depends on: 2.3
    • Tests first:
      • GET /api/public/tickets/{code}:
        • a bad shape is 404 TICKET_INVALID;
        • the tkt:load limit applies;
        • the event fields are added.
      • qr.png:
        • the PNG decodes back to <portal>/t/<code>;
        • an invalid ticket is 404;
        • the response is image/png, private.
      • Attendee save:
        • name, mobile and email normalised as in QR registration;
        • a missing permission gives a field error;
        • counter refusals map to public messages;
        • the tkt:submit limit applies.
      • Consent: the current notice id is sent.
      • Order view: carries the tickets when Paid.
      • Gateway: the three counter paths are public, other shapes are not.
    • Adds com.google.zxing:core to solvway-mobile-api/pom.xml. This hotspot runs alone.
    • Scope: solvway-mobile-api/**, solvway-api-gateway/src/**
    • Verify: mvn -T 1C -q -pl solvway-mobile-api,solvway-api-gateway verify
  • 3.2 Admin ticket endpoints.
    • Depends on: 3.1
    • Tests first:
      • GET /api/admin/tickets/{code}: BO_EVENTS and company-scoped (another company's ticket is 404).
      • checkin: passes the body, maps 409 codes, is @Audited.
      • Resend ticket: under BO_EVENT_TICKETS, @Audited.
      • Headcount: passes the ticket counts.
      • Check-in lookup: passes SHOW_TICKET, and walk-in TICKETS_ONLY maps to its message.
    • Scope: solvway-mobile-api/src/**
    • Verify: mvn -T 1C -q -pl solvway-mobile-api verify

4. admin-portal

  • 4.1 The ticket page /t/[code].
    • Depends on: 3.2
    • Tests first:
      • Public view: valid, checked in, not valid and unknown.
      • Consent: only on a valid named ticket, with the notice.
      • Staff view:
        • shown only when the session and admin call succeed;
        • a 401, 403 or 404 keeps the public view and never redirects;
        • Check in;
        • the unnamed form;
        • the refusal banners.
      • Routes:
        • the route guard lets /t/x through;
        • the proxies send one X-Forwarded-For hop;
        • the PNG proxy passes bytes and content type.
    • Scope: solvway-admin-portal/app/**
    • Verify: npx vitest run (check the exit code), npx tsc --noEmit, npm run lint
  • 4.2 Order page tickets, staff resend, counts, venue check-in message and labels.
    • Depends on: 4.1
    • Tests first:
      • Order page:
        • a Paid order lists tickets with links and copy buttons;
        • the naming form, with the permission tick, mobile or email, and field errors;
        • a refusal for a checked-in ticket.
      • Order detail: Resend ticket per valid ticket.
      • GuestsCard: the three ticket counts on a ticketed event.
      • /c/[token]: shows "Please show your ticket at the entrance." for SHOW_TICKET, with no form.
      • Labels: English and zh-CN, plus sql/02-ticket-labels.sql; seed regenerated.
    • Scope: solvway-admin-portal/app/**, openspec/changes/add-event-tickets/sql/**, local/seed/04-zh-cn-messages.sql
    • Verify: npx vitest run (check the exit code), npx tsc --noEmit, npm run lint

5. Verify and ship

  • 5.1 Rebuild the local stack, then check in Playwright, signing in through the form and clicking through.
    • On LC CV Expo, use the owner-approved test buyer "Tiket Test", tickets-test@example.com, and ask before any new order.
    • Open T-EKBD2K's order page and name an attendee. See the new link and that the old link is not valid.
    • On the ticket page, tick the consent and see the lead.
    • In the staff view, check a ticket in, then scan it again.
    • Check an unpaid ticket's refusal, and an unnamed ticket at the door.
    • Venue self check-in: a ticket holder, and a stranger who gets "show your ticket".
    • Check the counts on the event page and resend a ticket.
    • Take screenshots.
    • Depends on: 4.2
    • Done 2026-12-04. Not reachable: an unpaid ticket at the door, because an Awaiting order's tickets have no code yet. The staff banner for that state is covered by the page tests. Fixed during the check: the event leads list crashed on source Ticket, and order detail did not show which ticket is whose.
  • 5.2 Write the release note in docs/deployment.md. Open the PR to main and merge it, then archive the change in its own PR and republish the blueprint.
    • Depends on: 5.1