feat(form-builder): schema drift detection + PUT auto_save_count
S2c D5 completion: schema_version_at_open column + drift semantics. - Migration 2026_04_22_100002 adds unsignedInteger schema_version_at_open. Recorded by FormSubmissionService::createDraft at the moment the portal first renders the form. - PublicFormSubmissionResource.schema_drift now compares schema_version_at_open vs schema_version_at_submit (or schema.version for active drafts) so organiser edits during an open draft surface as drift on subsequent PUT/submit responses. - PublicFormSubmissionController::update routes through FormSubmissionService::saveDraft so auto_save_count increments and the FormSubmissionDraftUpdated event fires per PUT. - bootstrap/app.php: FormRequest ValidationException on /api/v1/public/forms/* is now re-wrapped into the D6 envelope with code=VALIDATION_FAILED, so public endpoints emit one consistent error shape regardless of layer. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -61,6 +61,7 @@ final class FormSubmissionService
|
||||
$submission->status = FormSubmissionStatus::DRAFT->value;
|
||||
$submission->is_test = (bool) ($context['is_test'] ?? false);
|
||||
$submission->opened_at = $context['opened_at'] ?? now();
|
||||
$submission->schema_version_at_open = (int) $schema->version;
|
||||
$submission->idempotency_key = $context['idempotency_key'] ?? null;
|
||||
$submission->public_submitter_name = $context['public_submitter_name'] ?? null;
|
||||
$submission->public_submitter_email = $context['public_submitter_email'] ?? null;
|
||||
|
||||
Reference in New Issue
Block a user