-
-
Notifications
You must be signed in to change notification settings - Fork 179
feat: Forms as Collections, Submissions as Content #623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mmcintosh
wants to merge
9
commits into
SonicJs-Org:main
Choose a base branch
from
mmcintosh:feature/forms-as-content-upstream
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: Forms as Collections, Submissions as Content #623
mmcintosh
wants to merge
9
commits into
SonicJs-Org:main
from
mmcintosh:feature/forms-as-content-upstream
Conversation
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
Form submissions now dual-write to both form_submissions and content tables, enabling unified content listing with filtering, search, and status management. Each form auto-creates a shadow collection, and the submissions page redirects to the content list filtered by form. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ation getManagedCollections() now filters by source_type to only return config-managed collections (user or NULL). Form-derived shadow collections (source_type='form') are managed by form-collection-sync and would be incorrectly deactivated by cleanupRemovedCollections since they don't appear in loadCollectionConfigs(). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Tests cover shadow collection creation, submissions-to-content redirect, form collection exclusion from new-content picker, Form badge display, submission metadata panel, content search, and status filtering. Submission-dependent tests gracefully skip when Turnstile is enabled. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Form-derived collections are an implementation detail managed through the forms UI. They should not appear on /admin/collections alongside user-defined collections. Filter by source_type to exclude them. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Extend PUT /admin/forms/:id to accept optional turnstile_enabled and turnstile_settings fields. Rewrite E2E tests to create forms with real Form.io schemas (contact form with name/email/subject/message, feedback form with rating selector), disable turnstile per-form, submit actual data, and verify content items appear with correct titles, Form badges, submission metadata, draft status, and search results. All 12 tests pass. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
A form submission is complete data — it should never be in draft state. Changed the default content status for new submissions from 'draft' to 'published'. Updated mapFormStatusToContentStatus so 'pending' maps to 'published' instead of 'draft'. Updated E2E test accordingly. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The CI pipeline runs migrations from my-sonicjs-app/migrations/, not packages/core/migrations/. Without this file, the source_type, source_id, and content_id columns are never created, causing the form-to-content dual-write to silently fail. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
D1 enforces foreign key constraints by default. The INSERT into content with author_id='system-form-submission' fails if the system user doesn't exist. Also auto-creates the shadow collection on-the-fly if it's missing during form submission, instead of silently returning null. - Check for and create system user at content creation time - Auto-create shadow collection if lookup returns null - Return contentId in submission API response - Add diagnostic logging and retry logic to E2E tests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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