refactor(form-builder): drop custom purpose escape from schemas
Reduces the FormPurpose vocabulary from 22 variants + a `custom` escape to the seven v1.0 purposes registered in the new PurposeRegistry. - Purge migration deletes any form_schemas row whose `purpose` is not in the v1.0 set (cascades through form_fields, form_submissions, form_values, form_value_options, form_schema_sections, form_submission_section_statuses, form_submission_delegations, form_schema_webhooks, form_webhook_deliveries via existing FK). - Drop migration removes the `custom_purpose_slug` column + its index. - Both migrations declare their `down()` as a hard failure — we do not support reversing a purge (pre-launch, no production data). - `FormPurpose` enum slims to the seven cases; the legacy helpers (defaultSubmissionMode / defaultSubjectType / allowsPublicAccess) now delegate to PurposeRegistry so callers keep working. - FormSchema fillable / FormSchemaResource / StoreFormSchemaRequest / UpdateFormSchemaRequest / FormSchemaFactory drop every reference to `custom_purpose_slug` and the `custom` purpose. - VerifyFormsDataIntegrity drops the custom-slug mismatch check and sources the subject-type allow-list from PurposeRegistry. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -30,7 +30,6 @@ final class StoreFormSchemaRequest extends FormRequest
|
||||
'name' => ['required', 'string', 'max:150'],
|
||||
'slug' => ['nullable', 'string', 'max:150'],
|
||||
'purpose' => ['required', Rule::in(FormPurpose::values())],
|
||||
'custom_purpose_slug' => ['nullable', 'string', 'max:150', 'required_if:purpose,custom'],
|
||||
'description' => ['nullable', 'string'],
|
||||
'is_published' => ['boolean'],
|
||||
'submission_mode' => ['nullable', Rule::in(FormSubmissionMode::cases() ? array_map(fn ($c) => $c->value, FormSubmissionMode::cases()) : [])],
|
||||
|
||||
@@ -26,7 +26,6 @@ final class UpdateFormSchemaRequest extends FormRequest
|
||||
'name' => ['sometimes', 'string', 'max:150'],
|
||||
'slug' => ['sometimes', 'string', 'max:150'],
|
||||
'purpose' => ['sometimes', Rule::in(FormPurpose::values())],
|
||||
'custom_purpose_slug' => ['nullable', 'string', 'max:150'],
|
||||
'description' => ['nullable', 'string'],
|
||||
'is_published' => ['sometimes', 'boolean'],
|
||||
'submission_mode' => ['sometimes', Rule::in(array_map(fn ($c) => $c->value, FormSubmissionMode::cases()))],
|
||||
|
||||
@@ -40,7 +40,6 @@ final class FormSchemaResource extends JsonResource
|
||||
'name' => $this->name,
|
||||
'slug' => $this->slug,
|
||||
'purpose' => $this->purpose instanceof \BackedEnum ? $this->purpose->value : $this->purpose,
|
||||
'custom_purpose_slug' => $this->custom_purpose_slug,
|
||||
'description' => $this->description,
|
||||
'is_published' => (bool) $this->is_published,
|
||||
'submission_mode' => $this->submission_mode instanceof \BackedEnum ? $this->submission_mode->value : $this->submission_mode,
|
||||
|
||||
Reference in New Issue
Block a user