feat: Forms as Collections, Submissions as Content#623
Open
mmcintosh wants to merge 1 commit intoSonicJs-Org:mainfrom
Open
feat: Forms as Collections, Submissions as Content#623mmcintosh wants to merge 1 commit intoSonicJs-Org:mainfrom
mmcintosh wants to merge 1 commit intoSonicJs-Org:mainfrom
Conversation
8 tasks
Each form auto-creates a shadow collection in the collections table.
Submissions dual-write to both form_submissions and content, enabling
unified listing at /admin/content with form badge, submission metadata
panel, and full search/filter support.
- New migration (032): source_type/source_id on collections, content_id on form_submissions, system user
- New service (form-collection-sync.ts): shadow collection management, schema derivation, dual-write, backfill
- Bootstrap integration: syncs form collections on startup
- Content list: form badge, submitter metadata, form collections in filter
- Content edit: read-only Submission Info panel
- Submissions redirect: /admin/forms/:id/submissions → /admin/content?model=form_{name}
- Collection isolation: form-derived collections hidden from /admin/collections and new-content picker
- Cleanup protection: getManagedCollections() excludes source_type='form'
- Turnstile settings: PUT /admin/forms/:id accepts turnstile_enabled/turnstile_settings
- 82 unit tests (98.3% statement coverage) + 12 E2E tests covering full integration flow
eff2aaa to
b10dba6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Integrates form submissions into the unified content management system. Each form auto-creates a "shadow collection" in the
collections table. When a submission arrives, it dual-writes to both form_submissions (preserving metadata like IP, user agent, UTM)
and content (enabling unified listing). Form submissions appear at /admin/content, filterable by model, status, and searchable — just
like regular content.
Changes
Database Migration (032_form_content_integration.sql)
New Service (form-collection-sync.ts)
Bootstrap Integration
Admin UI Updates
Collection Isolation
Form API Enhancement
Testing
Unit Tests
E2E Tests
E2E coverage:
Screenshots/Videos
Checklist