Add Registration Questions domain (per-offering intake forms) #11

Merged
thatguygriff merged 1 commits from feature/registration-questions into main 2026-06-05 14:17:23 +00:00
Owner

Implements #5 (Registration Questions). Builds on the Offerings foundation (#1).

What's included

  • src/Registration/ domainQuestion + Answer value objects, QuestionRepository + AnswerRepository, QuestionEndpoint (REST), QuestionController + templates/admin/questions.php
  • Tables in Schema.phpus_questions and us_question_answers (polymorphic registration_type/registration_id, shared with policies later)
  • Field typestext / textarea / select / checkbox; select options stored as JSON
  • Admin — an Offerings → Questions submenu with an offering picker; scoped to the caller's own offerings unless they are a studio admin
  • WiringPlugin, RestRegistrar, AdminMenu

REST API

Method Endpoint Permission
GET /offerings/{id}/questions public (active questions)
POST /questions manage_questions + offering owner/studio-admin
PATCH /questions/{id} manage_questions + offering owner/studio-admin
DELETE /questions/{id} manage_questions + offering owner/studio-admin

Notes

  • AnswerRepository (insert / insertMany / findByRegistration) is built here and will be consumed by the booking/enrolment flow in #3/#4.

Tests

  • tests/Unit/Registration/ — Question, Answer, QuestionRepository, AnswerRepository (19 tests)
  • composer test (63 total), composer cs, and PHPStan level 6 all pass

Refs #5

🤖 Generated with Claude Code

Implements **#5 (Registration Questions)**. Builds on the Offerings foundation (#1). ## What's included - **`src/Registration/` domain** — `Question` + `Answer` value objects, `QuestionRepository` + `AnswerRepository`, `QuestionEndpoint` (REST), `QuestionController` + `templates/admin/questions.php` - **Tables** in `Schema.php` — `us_questions` and `us_question_answers` (polymorphic `registration_type`/`registration_id`, shared with policies later) - **Field types** — `text` / `textarea` / `select` / `checkbox`; `select` options stored as JSON - **Admin** — an **Offerings → Questions** submenu with an offering picker; scoped to the caller's own offerings unless they are a studio admin - **Wiring** — `Plugin`, `RestRegistrar`, `AdminMenu` ## REST API | Method | Endpoint | Permission | |---|---|---| | GET | `/offerings/{id}/questions` | public (active questions) | | POST | `/questions` | `manage_questions` + offering owner/studio-admin | | PATCH | `/questions/{id}` | `manage_questions` + offering owner/studio-admin | | DELETE | `/questions/{id}` | `manage_questions` + offering owner/studio-admin | ## Notes - `AnswerRepository` (`insert` / `insertMany` / `findByRegistration`) is built here and will be consumed by the booking/enrolment flow in #3/#4. ## Tests - `tests/Unit/Registration/` — Question, Answer, QuestionRepository, AnswerRepository (19 tests) - `composer test` (63 total), `composer cs`, and PHPStan level 6 all pass Refs #5 🤖 Generated with [Claude Code](https://claude.com/claude-code)
thatguygriff added 1 commit 2026-06-05 14:11:34 +00:00
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
e61d99daed
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>
thatguygriff merged commit 6397f08398 into main 2026-06-05 14:17:23 +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#11