Add Registration Questions domain (per-offering intake forms)
CI / Coding Standards (pull_request) Successful in 51s
CI / PHPStan (pull_request) Successful in 1m0s
CI / Tests (PHP 8.1) (pull_request) Successful in 46s
CI / Tests (PHP 8.2) (pull_request) Successful in 48s
CI / Tests (PHP 8.3) (pull_request) Successful in 47s
CI / No Debug Code (pull_request) Successful in 3s

Implements #5: studio admin / instructors author intake questions scoped
per offering; answers are stored against a lesson or group enrolment via a
polymorphic registration reference.

- src/Registration/: Question + Answer value objects, QuestionRepository
  and AnswerRepository, QuestionEndpoint (REST), QuestionController +
  templates/admin/questions.php (Offerings -> Questions submenu)
- us_questions and us_question_answers tables in Schema.php
- REST: public GET /offerings/{id}/questions; POST/PATCH/DELETE /questions
  gated by manage_questions + offering ownership (owner or studio admin)
- Field types text/textarea/select/checkbox; select options stored as JSON
- Wiring in Plugin, RestRegistrar, AdminMenu

AnswerRepository is built now and consumed by the booking/enrolment flow
in #3/#4.

Tests: tests/Unit/Registration/ (19 tests). composer test (63 total), cs,
and PHPStan level 6 all pass.

Refs #5

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-05 11:11:06 -03:00
parent 5b6cc4e89b
commit e61d99daed
15 changed files with 1141 additions and 4 deletions
+15 -1
View File
@@ -10,17 +10,21 @@ use Unsupervised\Schedular\Booking\BookingRepository;
use Unsupervised\Schedular\Booking\LessonController;
use Unsupervised\Schedular\Offering\OfferingController;
use Unsupervised\Schedular\Offering\OfferingRepository;
use Unsupervised\Schedular\Registration\QuestionController;
use Unsupervised\Schedular\Registration\QuestionRepository;
class AdminMenu {
private AvailabilityController $availabilityController;
private LessonController $lessonController;
private OfferingController $offeringController;
private QuestionController $questionController;
public function __construct( AvailabilityRepository $availability, BookingRepository $bookings, OfferingRepository $offerings ) {
public function __construct( AvailabilityRepository $availability, BookingRepository $bookings, OfferingRepository $offerings, QuestionRepository $questions ) {
$this->availabilityController = new AvailabilityController( $availability );
$this->lessonController = new LessonController( $bookings );
$this->offeringController = new OfferingController( $offerings );
$this->questionController = new QuestionController( $questions, $offerings );
}
public function register(): void {
@@ -61,6 +65,16 @@ class AdminMenu {
33
);
// Studio admin / instructor: manage per-offering intake questions.
add_submenu_page(
'us-offerings',
__( 'Questions', 'unsupervised-schedular' ),
__( 'Questions', 'unsupervised-schedular' ),
RoleManager::CAP_MANAGE_QUESTIONS,
'us-questions',
[ $this->questionController, 'renderPage' ]
);
// Instructor: view their upcoming lessons.
add_menu_page(
__( 'My Lessons', 'unsupervised-schedular' ),