feat(api): age group on products #89

Merged
amiryahaya merged 1 commit from feat/age-group into main 2026-10-23 15:16:29 +02:00
Owner

Stacked on #88 (the wallet ledger): this PR's base is feat/wallet-ledger because both add a migration (#88 owns 0010, this is 0011). When #88 merges I will rebase onto main and retarget this PR, so the diff you review now is only the age-group change.

What

age_group (adult, child, infant) on products, a structured field instead of a magic name.

Legacy found "the adult ticket" by matching the string "Adult" (the park page's "from" price, the park email's fee table) and "Children"; renaming a product silently broke them. Now:

  • Migration 0011: nullable products.age_group with a CHECK. Null for vehicle fees, extras and master tickets.
  • Product API: accepted (blank means none), validated, returned. Identity is unchanged (name + resident type + category): the age group classifies, it does not allow a second "Adult".
  • Shop price lookup: every quote carries age_group (null when none), so clients group tickets without matching names.
  • Spec and clients: OpenAPI updated; the live contract test names the adult product "Grown-up" on purpose and asserts the quote still says adult; the TypeScript compile-time check rejects age_group: "senior".

Why now

Both checkout (#26) and limited-seat products need to know what an "adult" or "child" is, and a seat cap may count people by age group.

Open question for the project owner [verify]

Rules that depend on age or group size are not modelled: the children's age limit, free infants, and the T&C rule that non-residents equalling or outnumbering citizens pay the non-resident fee. Also: should every park-entry ticket be required to have an age group? It is optional for now because legacy may have park-entry products that are neither (annual passes).

Standards review (docs/development-standards.md)

  • TDD: migration, validation, store, pricing and contract tests written first, each red for the right reason.
  • SOLID / coupling: an additive field through existing narrow interfaces; no new dependency between modules.
  • Coverage: 94.6% total; catalog 100%, pricing 100%. make lint 0 issues. Both generated clients compile. Security scans run on main after merge.

🤖 Generated with Claude Code

**Stacked on #88 (the wallet ledger)**: this PR's base is `feat/wallet-ledger` because both add a migration (#88 owns 0010, this is 0011). When #88 merges I will rebase onto `main` and retarget this PR, so the diff you review now is only the age-group change. ## What `age_group` (adult, child, infant) on products, a structured field instead of a magic name. Legacy found "the adult ticket" by matching the string `"Adult"` (the park page's "from" price, the park email's fee table) and `"Children"`; renaming a product silently broke them. Now: - **Migration 0011**: nullable `products.age_group` with a CHECK. Null for vehicle fees, extras and master tickets. - **Product API**: accepted (blank means none), validated, returned. Identity is unchanged (name + resident type + category): the age group classifies, it does not allow a second "Adult". - **Shop price lookup**: every quote carries `age_group` (null when none), so clients group tickets without matching names. - **Spec and clients**: OpenAPI updated; the live contract test names the adult product **"Grown-up"** on purpose and asserts the quote still says `adult`; the TypeScript compile-time check rejects `age_group: "senior"`. ## Why now Both checkout (#26) and limited-seat products need to know what an "adult" or "child" is, and a seat cap may count people by age group. ## Open question for the project owner [verify] Rules that depend on age or group size are **not modelled**: the children's age limit, free infants, and the T&C rule that non-residents equalling or outnumbering citizens pay the non-resident fee. Also: should every park-entry ticket be *required* to have an age group? It is optional for now because legacy may have park-entry products that are neither (annual passes). ## Standards review (docs/development-standards.md) - **TDD**: migration, validation, store, pricing and contract tests written first, each red for the right reason. - **SOLID / coupling**: an additive field through existing narrow interfaces; no new dependency between modules. - **Coverage**: 94.6% total; catalog 100%, pricing 100%. `make lint` 0 issues. Both generated clients compile. Security scans run on `main` after merge. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(api): age group on products, so nothing finds the adult ticket by its name
All checks were successful
ci / changes (pull_request) Successful in 11s
ci / clients (pull_request) Successful in 1m9s
ci / api (pull_request) Successful in 7m26s
ci / ci-gate (pull_request) Successful in 3s
96f3b09bd5
Migration 0011 adds a nullable age_group (adult, child, infant) to products. It is validated, stored, returned
by the product API and carried through the shop price lookup (Quote.age_group). Identity is unchanged. The
OpenAPI spec, contract test (the adult product is named 'Grown-up' on purpose) and the TypeScript compile-time
check cover it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
amiryahaya changed title from feat(api): age group on products (stacked on #88) to feat(api): age group on products 2026-10-23 12:48:17 +02:00
amiryahaya changed target branch from feat/wallet-ledger to main 2026-10-23 12:48:17 +02:00
amiryahaya force-pushed feat/age-group from 96f3b09bd5
All checks were successful
ci / changes (pull_request) Successful in 11s
ci / clients (pull_request) Successful in 1m9s
ci / api (pull_request) Successful in 7m26s
ci / ci-gate (pull_request) Successful in 3s
to ef0696cd1e
All checks were successful
ci / changes (pull_request) Successful in 12s
ci / clients (pull_request) Successful in 56s
ci / api (pull_request) Successful in 4m10s
ci / ci-gate (pull_request) Successful in 2s
2026-10-23 12:48:17 +02:00
Compare
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!89
No description provided.