Add Policies domain (drafting, versioning, tracked acceptance) #15
Reference in New Issue
Block a user
Delete Branch "feature/policies"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements #6 (Policies) — the second registration gate (standalone, no payment dependency).
What's included
src/Policy/domain —Policy,PolicyVersion(draft/published/archived),PolicyAcceptancevalue objects;PolicyRepository,PolicyVersionRepository,AcceptanceRepository;PolicyService;PolicyEndpoint;PolicyController+templates/admin/policies.phpSchema.php—us_policies,us_policy_versions,us_policy_acceptancesPolicyServiceorchestrates the multi-table publish flow: archive the prior current version, stamppublished_at, and repointcurrent_version_idmanage_policies): create a policy, add/publish draft versions, see which version is currentREST API
/policies/policiesmanage_policies/policies/{id}/versionsmanage_policies/policies/{id}/versions/{vid}manage_policies(draft only)/policies/{id}/versions/{vid}/publishmanage_policiesVersioning & acceptance
Acceptance is bound to
policy_version_id, so publishing a new version leaves it unaccepted — students must re-accept at their next booking.AcceptanceRepositoryis built here and consumed by the booking/enrolment gate in #3/#4.Also
Bumped PHPStan to
--memory-limit=1Gin thecomposer lintscript — the default 128M now crashes analysis as the codebase has grown (would otherwise fail thestatic-analysisCI job).Tests
tests/Unit/Policy/— value objects, three repositories, and thePolicyServicepublish orchestration (25 new tests)composer test(90 total),composer cs, and PHPStan level 6 all passRefs #6
🤖 Generated with Claude Code