CI / Tests (PHP 8.1) (pull_request) Successful in 1m0s
CI / Tests (PHP 8.2) (pull_request) Successful in 1m0s
CI / No Debug Code (pull_request) Successful in 3s
CI / Coding Standards (pull_request) Successful in 3m8s
CI / Build Plugin Zip (pull_request) Skipped
CI / PHPStan (pull_request) Successful in 2m49s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m44s
Five items from the latest demo pass: - A policy's title can be edited from the Policies screen. Only the title moves; the slug is what the gates resolve policies by, so a rename can never detach a policy from acceptances already recorded against it. - Signup is one page again. The studio's registration questions move from a second step behind "Next" onto the main form, in an "About you" panel above the students being added, and that panel also asks an adult student for their birth year (the same us_birth_year meta a child's uses). register.js disables and hides the whole panel for a pure guardian, since the questions describe a student. - The password is re-scored on submit, not only as it is typed. zxcvbn's dictionary arrives after page load, so a password typed straight away was never scored at all and the first the student heard of it was the server rejecting the whole form. - Group-class sessions appear alongside lessons wherever upcoming lessons are listed: the [us_scheduler] panel (students and instructors) and the admin student detail page. GroupClass\SessionSchedule derives them from Offering::sessionWindows(), the same derivation the billing scan uses. They carry kind = 'group_class' and no Cancel action - a session is one date in a term, not a booked slot. - Deleting a user releases what the account was holding: each upcoming lesson is cancelled, its slot freed for rebooking, its pending payment voided, and active class enrolments cancelled. Past lessons and paid history are left alone. Tests: composer test (851), composer lint, composer cs all pass. Co-Authored-By: Claude Opus 5 <[email protected]>
66 lines
3.5 KiB
PHP
66 lines
3.5 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace Unsupervised\Schedular;
|
|
|
|
use Unsupervised\Schedular\Availability\AvailabilityEndpoint;
|
|
use Unsupervised\Schedular\Availability\AvailabilityRepository;
|
|
use Unsupervised\Schedular\Availability\WindowValidator;
|
|
use Unsupervised\Schedular\Booking\BookingEndpoint;
|
|
use Unsupervised\Schedular\Booking\BookingRepository;
|
|
use Unsupervised\Schedular\Booking\CancellationPolicy;
|
|
use Unsupervised\Schedular\GroupClass\EnrollmentEndpoint;
|
|
use Unsupervised\Schedular\GroupClass\GroupAccessRepository;
|
|
use Unsupervised\Schedular\GroupClass\EnrollmentRepository;
|
|
use Unsupervised\Schedular\GroupClass\SessionSchedule;
|
|
use Unsupervised\Schedular\Guardian\GuardianService;
|
|
use Unsupervised\Schedular\Offering\OfferingEndpoint;
|
|
use Unsupervised\Schedular\Offering\OfferingRepository;
|
|
use Unsupervised\Schedular\Payment\PaymentEndpoint;
|
|
use Unsupervised\Schedular\Payment\PaymentService;
|
|
use Unsupervised\Schedular\Payment\StudioSettings;
|
|
use Unsupervised\Schedular\Policy\PolicyEndpoint;
|
|
use Unsupervised\Schedular\Policy\PolicyRepository;
|
|
use Unsupervised\Schedular\Policy\PolicyService;
|
|
use Unsupervised\Schedular\Policy\PolicyVersionRepository;
|
|
use Unsupervised\Schedular\Registration\QuestionEndpoint;
|
|
use Unsupervised\Schedular\Registration\QuestionRepository;
|
|
use Unsupervised\Schedular\Registration\RegistrationGate;
|
|
|
|
class RestRegistrar {
|
|
|
|
public const NAMESPACE = 'us-scheduler/v1';
|
|
|
|
private AvailabilityEndpoint $availabilityEndpoint;
|
|
private BookingEndpoint $bookingEndpoint;
|
|
private OfferingEndpoint $offeringEndpoint;
|
|
private QuestionEndpoint $questionEndpoint;
|
|
private PolicyEndpoint $policyEndpoint;
|
|
private EnrollmentEndpoint $enrollmentEndpoint;
|
|
private PaymentEndpoint $paymentEndpoint;
|
|
|
|
public function __construct( AvailabilityRepository $availability, BookingRepository $bookings, OfferingRepository $offerings, QuestionRepository $questions, PolicyRepository $policies, PolicyVersionRepository $policyVersions, PolicyService $policyService, RegistrationGate $gate, EnrollmentRepository $enrollments, GroupAccessRepository $groupAccess, PaymentService $paymentService, GuardianService $guardians ) {
|
|
$this->availabilityEndpoint = new AvailabilityEndpoint( $availability, new WindowValidator( $offerings ) );
|
|
$this->bookingEndpoint = new BookingEndpoint( $availability, $bookings, $offerings, $gate, $paymentService, new CancellationPolicy( new StudioSettings() ), $guardians, new SessionSchedule( $enrollments, $offerings ) );
|
|
$this->offeringEndpoint = new OfferingEndpoint( $offerings, $groupAccess );
|
|
$this->questionEndpoint = new QuestionEndpoint( $questions, $offerings );
|
|
$this->policyEndpoint = new PolicyEndpoint( $policies, $policyVersions, $policyService );
|
|
$this->enrollmentEndpoint = new EnrollmentEndpoint( $enrollments, $offerings, $gate, $paymentService, $groupAccess, $guardians );
|
|
$this->paymentEndpoint = new PaymentEndpoint( $paymentService );
|
|
}
|
|
|
|
public function register(): void {
|
|
add_action( 'rest_api_init', [ $this, 'registerRoutes' ] );
|
|
}
|
|
|
|
public function registerRoutes(): void {
|
|
$this->availabilityEndpoint->registerRoutes( self::NAMESPACE );
|
|
$this->bookingEndpoint->registerRoutes( self::NAMESPACE );
|
|
$this->offeringEndpoint->registerRoutes( self::NAMESPACE );
|
|
$this->questionEndpoint->registerRoutes( self::NAMESPACE );
|
|
$this->policyEndpoint->registerRoutes( self::NAMESPACE );
|
|
$this->enrollmentEndpoint->registerRoutes( self::NAMESPACE );
|
|
$this->paymentEndpoint->registerRoutes( self::NAMESPACE );
|
|
}
|
|
}
|