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
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
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>
This commit is contained in:
@@ -16,11 +16,25 @@ class Lesson {
|
||||
*/
|
||||
public const VALID_STATUSES = [ self::STATUS_PENDING, self::STATUS_CONFIRMED, self::STATUS_CANCELLED ];
|
||||
|
||||
public const RECURRENCE_SINGLE = 'single';
|
||||
public const RECURRENCE_WEEKLY = 'weekly';
|
||||
|
||||
/**
|
||||
* All valid recurrence values.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
public const VALID_RECURRENCES = [ self::RECURRENCE_SINGLE, self::RECURRENCE_WEEKLY ];
|
||||
|
||||
public function __construct(
|
||||
public readonly int $slotId,
|
||||
public readonly int $studentId,
|
||||
public readonly int $instructorId,
|
||||
public readonly ?int $offeringId = null,
|
||||
public readonly string $recurrence = self::RECURRENCE_SINGLE,
|
||||
public readonly ?int $seriesId = null,
|
||||
public readonly string $status = self::STATUS_PENDING,
|
||||
public readonly ?int $paymentId = null,
|
||||
public readonly ?string $notes = null,
|
||||
public readonly ?int $id = null,
|
||||
) {}
|
||||
@@ -30,7 +44,11 @@ class Lesson {
|
||||
slotId: (int) $row->slot_id,
|
||||
studentId: (int) $row->student_id,
|
||||
instructorId: (int) $row->instructor_id,
|
||||
offeringId: null !== $row->offering_id ? (int) $row->offering_id : null,
|
||||
recurrence: $row->recurrence,
|
||||
seriesId: null !== $row->series_id ? (int) $row->series_id : null,
|
||||
status: $row->status,
|
||||
paymentId: null !== $row->payment_id ? (int) $row->payment_id : null,
|
||||
notes: $row->notes,
|
||||
id: (int) $row->id,
|
||||
);
|
||||
@@ -45,9 +63,13 @@ class Lesson {
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'slot_id' => $this->slotId,
|
||||
'offering_id' => $this->offeringId,
|
||||
'student_id' => $this->studentId,
|
||||
'instructor_id' => $this->instructorId,
|
||||
'recurrence' => $this->recurrence,
|
||||
'series_id' => $this->seriesId,
|
||||
'status' => $this->status,
|
||||
'payment_id' => $this->paymentId,
|
||||
'notes' => $this->notes,
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user