Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
180 lines
8.5 KiB
Markdown
180 lines
8.5 KiB
Markdown
# 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
|
|
|
|
- [x] 1.1 Write the SQL:
|
|
- `sql/01-event-ticket-orders.sql`: the event columns, `ticket_type`, `shop_order`, `shop_order_line` and `ticket`;
|
|
- `sql/02-event-tickets-module.sql`: `BO_EVENT_TICKETS`;
|
|
- `sql/99-rollback.sql`.
|
|
|
|
Mirror 01 and 02 in `local/seed/03-colite.sql`, and apply them to the local database.
|
|
- Depends on: none
|
|
- Scope: `local/seed/**`, `openspec/changes/add-event-ticket-orders/sql/**`
|
|
- Verify: `SELECT` shows the tables, keys, event columns and module row.
|
|
|
|
## 2. services-counter
|
|
|
|
- [x] 2.1 Ticket entities, settings and ticket types.
|
|
- Depends on: 1.1
|
|
- Tests first:
|
|
- **Entities:** they map to the DDL.
|
|
- **Ticket settings** (own endpoint `ticketType/settings`; an event edit keeps the stored settings):
|
|
- switching on with blank instructions is refused on the field;
|
|
- hold days 0 or 15 are refused;
|
|
- a valid save persists.
|
|
- **Type save:**
|
|
- a duplicate name gives `NAME_TAKEN`;
|
|
- a quantity below held gives `QUANTITY_BELOW_HELD`;
|
|
- another company's event gives 404.
|
|
- **Type delete:** gives `TYPE_HAS_ORDERS` when the type has orders.
|
|
- **`list`:** gives the right `held` and `left` with a mix of ACTIVE and CANCELLED tickets and AWAITING, PAID and EXPIRED orders.
|
|
- **`onSale`:** gives only enabled types, the right `state` values (`ON_SALE`, `SOLD_OUT`, `ENDED`) and no company data.
|
|
- Scope: `solvway-services-counter/src/**`
|
|
- Verify: `mvn -T 1C -q -pl solvway-services-counter verify`
|
|
- [x] 2.2 Order request, seat locking, capacity and the buyer as a lead.
|
|
- Depends on: 2.1
|
|
- Tests first:
|
|
- **Request outcomes:**
|
|
- a valid request makes an order, its lines and its tickets, with the reference format, the token and the correct total;
|
|
- a total of 0 makes the order PAID;
|
|
- quantities 0, 11 or negative give `BAD_QUANTITY`;
|
|
- a disabled type, a type past its sales end, or a type short of seats gives `TYPE_UNAVAILABLE` with `left`;
|
|
- a 4th awaiting order gives `TOO_MANY_AWAITING`;
|
|
- Tickets off, a disabled event or an ended event gives `TICKETS_CLOSED`.
|
|
- **Capacity:**
|
|
- before the event days, guests plus walk-ins plus held tickets over capacity gives `EVENT_FULL` with `left`;
|
|
- on the event days it does not.
|
|
- **Concurrency:** the unit test proves the event lock is taken before seats are counted. The module has no test database, and adding H2 or Testcontainers would be a new dependency for one test. So the real lock and the JPQL are checked against the local MySQL stack in 5.1: the counter boots, which validates the queries, and two parallel requests race for the last seat.
|
|
- **Buyer lead:**
|
|
- a new buyer gets an event lead with source `TICKET` and the UTM values;
|
|
- a buyer already captured keeps the old source and gets a note naming the reference.
|
|
- **Headcount:** it adds `heldTickets`, and the invite registration's capacity check counts held tickets.
|
|
- Scope: `solvway-services-counter/src/**`
|
|
- Verify: `mvn -T 1C -q -pl solvway-services-counter verify`
|
|
- [x] 2.3 Staff order actions, the expiry job and emails.
|
|
- Depends on: 2.2
|
|
- Tests first:
|
|
- **`list`:** filter, search and paging.
|
|
- **`get`:** another company's order gives 404.
|
|
- **`markPaid`:**
|
|
- from AWAITING;
|
|
- from EXPIRED with seats free;
|
|
- `SEATS_GONE`;
|
|
- `NOT_PAYABLE` from PAID or CANCELLED.
|
|
- **`cancel`:** frees the seats; `NOT_CANCELLABLE` from EXPIRED.
|
|
- **`cancelTicket`:** lowers the total and frees the seat; `LAST_TICKET`.
|
|
- **Expiry job:**
|
|
- expires only orders past their hold;
|
|
- a conditional update never overwrites PAID.
|
|
- **Mailer:**
|
|
- sends after commit;
|
|
- escapes user values;
|
|
- puts the order link in the email;
|
|
- records `last_email`;
|
|
- a failed send leaves the order changed.
|
|
- **`resend`:** sends the `last_email` kind.
|
|
- Scope: `solvway-services-counter/src/**`
|
|
- Verify: `mvn -T 1C -q -pl solvway-services-counter verify`
|
|
- [x] 2.4 `CmsBlockValidator` TICKETS.
|
|
- Depends on: 2.1
|
|
- Tests first:
|
|
- **Event checks:**
|
|
- a TICKETS block without an event is refused;
|
|
- another company's event is refused;
|
|
- an event with Tickets off is refused;
|
|
- an ended event is refused.
|
|
- **Field limits:**
|
|
- a heading of 121 characters is refused;
|
|
- text of 1001 characters is refused;
|
|
- an unused field is refused with `PagesUnusedField`.
|
|
- **Valid block:** a valid block with eyebrow, look and anchor is accepted.
|
|
- Scope: `solvway-services-counter/src/**`
|
|
- Verify: `mvn -T 1C -q -pl solvway-services-counter verify`
|
|
|
|
## 3. mobile-api and gateway
|
|
|
|
- [x] 3.1 Admin ticket endpoints.
|
|
- Depends on: 2.3
|
|
- Tests first:
|
|
- **Gating:**
|
|
- every endpoint gives 403 without `BO_EVENT_TICKETS`;
|
|
- another company's event or order gives 404;
|
|
- the event PUT ignores ticket settings without the permission.
|
|
- **Audit:** each write is audited.
|
|
- **Event GET:** it returns `ticketsEnabled`.
|
|
- Scope: `solvway-mobile-api/src/**`
|
|
- Verify: `mvn -T 1C -q -pl solvway-mobile-api verify`
|
|
- [x] 3.2 Public TICKETS page data, request and order page, and the gateway paths.
|
|
- Depends on: 2.4, 3.1
|
|
- Tests first:
|
|
- **Page data:** the page GET adds `tickets` or `closed` to a TICKETS block.
|
|
- **Request:**
|
|
- the honeypot gives a fake success and nothing is posted;
|
|
- the `reg:submit` limit applies;
|
|
- inputs are normalised;
|
|
- counter errors map to the right public messages.
|
|
- **Order page:**
|
|
- a bad token shape gives 404 with no backend call;
|
|
- the `ord:load` limit applies;
|
|
- the payment instructions appear only while AWAITING.
|
|
- **Gateway:** the three paths are open and nothing else changes.
|
|
- Scope: `solvway-mobile-api/src/**`, `solvway-api-gateway/src/**`
|
|
- Verify: `mvn -T 1C -q -pl solvway-mobile-api,solvway-api-gateway verify`
|
|
|
|
## 4. Portal
|
|
|
|
- [x] 4.1 Event Tickets section, orders list and order detail.
|
|
- Depends on: 3.1
|
|
- Tests first:
|
|
- **Visibility:** the section is hidden without `BO_EVENT_TICKETS`.
|
|
- **Settings form:** shows the validation errors.
|
|
- **Types table:** add, edit and disable, with the delete error shown.
|
|
- **Orders list:** filter and search.
|
|
- **Order detail actions:**
|
|
- mark paid with a reference;
|
|
- cancel order and cancel ticket, each with a confirm;
|
|
- the `SEATS_GONE` and `LAST_TICKET` messages shown;
|
|
- resend.
|
|
- **`ROUTE_MODULES`:** the new pages are mapped.
|
|
- Scope: `solvway-admin-portal/app/**`
|
|
- Verify: `npx vitest run` (check the exit code), `npx tsc --noEmit`, `npm run lint`
|
|
- [ ] 4.2 The TICKETS block, the editors and the order page.
|
|
- Depends on: 3.2, 4.1
|
|
- Tests first:
|
|
- **Renderer:**
|
|
- types, prices, `Free`, sold out and sales ended;
|
|
- steppers capped at 10 in total;
|
|
- the running total;
|
|
- field errors;
|
|
- the thank-you with instructions and the order link;
|
|
- the free-order confirmation;
|
|
- the closed state.
|
|
- **Editors:** the block appears in the Add section menu; the event picker lists only events with tickets on.
|
|
- **`/o/[token]`:**
|
|
- states and instructions;
|
|
- the invalid link message;
|
|
- the route is public;
|
|
- the proxy sends one X-Forwarded-For hop.
|
|
- **Labels:** in English and zh-CN, plus the `sql/03-*-labels.sql` file.
|
|
- Scope: `solvway-admin-portal/app/**`, `openspec/changes/add-event-ticket-orders/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.
|
|
- Sign in as admin.
|
|
- Grant Event tickets to the role.
|
|
- Click into the test event, turn Tickets on, and add the types.
|
|
- Add a TICKETS block to a **draft** test page.
|
|
- Open its preview and request tickets with a disposable buyer the owner nominates. Ask before saving any order.
|
|
- See the order in staff screens, mark it paid, and cancel a ticket.
|
|
- Check the blocked paths: over 10 tickets, sold out, missing consent, and an unknown order link.
|
|
- Take screenshots.
|
|
- Depends on: 4.2
|
|
- [ ] 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.
|
|
- Depends on: 5.1
|