Add lesson booking registration flow (offering, questions, policies) #20

Merged
thatguygriff merged 1 commits from feature/registration-flow into main 2026-06-07 14:30:01 +00:00
Owner

Implements #3 (Lesson booking) — the registration flow tying offerings, intake questions, and booking-scoped policy acceptance together. (Group classes #4 follow as the next PR, reusing the gate.)

Backend

  • Schema: us_lessons += offering_id, recurrence, series_id, payment_id.
  • Lesson: new fields + RECURRENCE_SINGLE/WEEKLY.
  • BookingRepository::insertSeries() builds a weekly series sharing a series_id; AvailabilityRepository::findUnbookedInGroup() reserves the recurring group.
  • RegistrationGate (src/Registration/): validate() + record() for required intake answers and booking-scoped policy acceptances — shared with group enrolment (#4).
  • BookingEndpoint::book(): accepts offering_id, recurrence, answers, accepted_policy_version_ids; books a single lesson or a weekly series; records answers + acceptances (type lesson).
  • GET /policies?scope=booking filter.

Front end

booking.js: slot → load offering questions + booking policies → form (questions, required policy checkboxes, optional weekly) → POST /bookings.

Payment seam

Payment is deferred to #7. A booking lands status = pending, payment_id = null; the instructor confirms via PATCH /bookings/{id}/status. The pay→confirm + receipt step plugs into this seam later.

Tests

  • Lesson, BookingRepository (incl. weekly series), and RegistrationGate (validate/record).
  • A test-only WP_Error stub added to tests/bootstrap.php (the gate returns WP_Error).
  • composer test (110 tests), composer cs, PHPStan level 6, and no-debug all pass.

Refs #3

🤖 Generated with Claude Code

Implements **#3 (Lesson booking)** — the registration flow tying offerings, intake questions, and booking-scoped policy acceptance together. (Group classes #4 follow as the next PR, reusing the gate.) ## Backend - **Schema**: `us_lessons` += `offering_id`, `recurrence`, `series_id`, `payment_id`. - **`Lesson`**: new fields + `RECURRENCE_SINGLE`/`WEEKLY`. - **`BookingRepository::insertSeries()`** builds a weekly series sharing a `series_id`; **`AvailabilityRepository::findUnbookedInGroup()`** reserves the recurring group. - **`RegistrationGate`** (`src/Registration/`): `validate()` + `record()` for required intake answers and booking-scoped policy acceptances — shared with group enrolment (#4). - **`BookingEndpoint::book()`**: accepts `offering_id`, `recurrence`, `answers`, `accepted_policy_version_ids`; books a single lesson or a weekly series; records answers + acceptances (type `lesson`). - **`GET /policies?scope=booking`** filter. ## Front end `booking.js`: slot → load offering questions + booking policies → form (questions, required policy checkboxes, optional weekly) → `POST /bookings`. ## Payment seam Payment is deferred to #7. A booking lands `status = pending`, `payment_id = null`; the instructor confirms via `PATCH /bookings/{id}/status`. The pay→confirm + receipt step plugs into this seam later. ## Tests - `Lesson`, `BookingRepository` (incl. weekly series), and `RegistrationGate` (validate/record). - A test-only `WP_Error` stub added to `tests/bootstrap.php` (the gate returns `WP_Error`). - `composer test` (110 tests), `composer cs`, PHPStan level 6, and no-debug all pass. Refs #3 🤖 Generated with [Claude Code](https://claude.com/claude-code)
thatguygriff added 1 commit 2026-06-07 14:25:49 +00:00
Add lesson booking registration flow (offering, questions, policies)
CI / Coding Standards (pull_request) Successful in 1m51s
CI / PHPStan (pull_request) Successful in 2m17s
CI / Tests (PHP 8.1) (pull_request) Successful in 2m24s
CI / No Debug Code (pull_request) Successful in 2s
CI / Tests (PHP 8.2) (pull_request) Successful in 42s
CI / Tests (PHP 8.3) (pull_request) Successful in 47s
CI / Build Plugin Zip (pull_request) Has been skipped
6d163e5d0e
Implements #3: students register for a private lesson by picking a slot,
answering the offering's intake questions, and accepting booking-scoped
policies. Payment is a clean seam for #7 (lessons land pending; payment_id
null; instructor confirms via PATCH /bookings/{id}/status).

- Schema: us_lessons += offering_id, recurrence, series_id, payment_id.
- Lesson: new fields + recurrence constants.
- BookingRepository::insertSeries() builds a weekly series sharing a
  series_id; AvailabilityRepository::findUnbookedInGroup() reserves a group.
- RegistrationGate (src/Registration/): validate + record intake answers and
  booking-scoped policy acceptances. Reused by group enrolment (#4).
- BookingEndpoint::book(): offering_id, recurrence, answers,
  accepted_policy_version_ids; single or weekly; records answers/acceptances
  (type lesson).
- GET /policies?scope=booking filter.
- Front-end booking.js: slot -> questions + policies -> submit.
- Wiring: RegistrationGate built in Plugin, passed via RestRegistrar.
- Test-only WP_Error stub in tests/bootstrap.php for gate testing.

Refs #3

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
thatguygriff merged commit 0b3832309d into main 2026-06-07 14:30:01 +00:00
thatguygriff deleted branch feature/registration-flow 2026-06-07 14:30:01 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Unsupervised/unsupervised-scheduler#20