Skip to content

feat: forms subsystem (admin + Coltorapps builder + public renderer + CSV export)#2011

Merged
cdcore09 merged 16 commits into
cdcore09/site-redesignfrom
cdcore09/forms-implementation
May 29, 2026
Merged

feat: forms subsystem (admin + Coltorapps builder + public renderer + CSV export)#2011
cdcore09 merged 16 commits into
cdcore09/site-redesignfrom
cdcore09/forms-implementation

Conversation

@cdcore09
Copy link
Copy Markdown
Contributor

Summary

Plan 4 of 5 from the events / announcements / forms brainstorm. Lands the forms subsystem on top of Plans 1-3: admin forms CRUD with inline Coltorapps form-builder, admin submissions list + CSV export, polymorphic form-to-entity attachment, and public /forms/:slug renderer + submission endpoint.

Schema parser (Task 1)

  • packages/api/src/lib/forms/schemaTypes.ts + schemaParser.ts — server-side source of truth for the stored schema shape. 9 field types: text, textarea, email, url, number, date, single_choice, multi_choice, checkbox. Hard caps (50 fields, 30 options per choice). validateSubmissionPayload checks every submission against the stored schema.

Admin API (Tasks 2-6)

  • POST/GET /admin/forms — create draft + list with status/scope/entityType/q filters
  • GET/PATCH /admin/forms/:id — detail (with reviews/comments/audit/submission count) + patch with schema re-validation + CHECK constraint enforcement (entityType + entityId both-or-neither)
  • POST /admin/forms/:id/transitions — wraps applyTransition with close instead of cancel for the staff-only post-publish action
  • POST /admin/forms/:id/comments — uses sanitizeCommentBody
  • GET /admin/forms/:id/submissions — paginated JSON list, plus CSV export via ?format=csv

Public API (Task 7)

  • GET /forms/:slug — scope-aware (anonymous can read public, signed-in can read community + public)
  • POST /forms/:slug/submissions — validates payload through validateSubmissionPayload, returns 201 with submissionId. Anonymous allowed iff form.scope='public'. 410 when accepts_submissions=false.

Coltorapps builder (Task 8, 11)

  • @coltorapps/builder + @coltorapps/builder-react v0.2.4 (MIT) installed in apps/admin only.
  • apps/admin/src/components/FormBuilder.tsx — wires Coltorapps' store-based headless primitives onto admin editorial design tokens. ↑/↓ reorder buttons (keyboard-accessible). Bidirectional adapter between Coltorapps' nested-entity format and our flat FormSchema.

Admin UI (Tasks 9-12)

  • /admin/forms list with filters
  • /admin/forms/new lightweight compose (title/slug/description; seeds a minimal valid form)
  • /admin/forms/:id detail page with Identity / Content (form builder) / Review / Audit tabs + "View submissions" link
  • /admin/forms/:id/submissions page with paginated table + CSV download button
  • Sidebar: Forms at slot 07 (Announcements 06, Recognition shifted to 08, etc.)

Public UI (Task 13)

  • apps/web/src/components/FormRenderer.tsx — renders the schema as an editable form. All 9 field types. Inline field errors on 400.
  • apps/web/src/pages/forms/FormPage.tsx at /forms/:slug — fetches form, wraps <FormRenderer /> with site chrome (dark gradient hero matching EventDetailPage aesthetic).

Stats

  • 16 commits, atomic, conventional, zero AI attribution
  • 275 vitest tests pass (234 from prior plans + 41 new for forms)
  • Full repo typecheck clean

Test plan

  • CI green (Cloudflare Pages preview deploys)
  • Manual: super_admin creates a form, builds out a few fields, submits for review, second super_admin approves twice — form publishes
  • Manual: anonymous visitor hits /forms/<slug>, fills out the form, submission lands in admin
  • Manual: download CSV and verify columns match schema fields
  • Manual: attach form to an event via API (admin UI attach picker is deferred — see follow-up note)

Plan + spec

Deferred (per spec §10 + scope notes)

  • File uploads on submissions
  • Form analytics (counts only in v1)
  • Multi-entity attachment (polymorphic columns enforce 1:1)
  • Admin "attach to entity" picker UI (set via API for now; UI follow-up)

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying usrse-github-io with  Cloudflare Pages  Cloudflare Pages

Latest commit: 741c581
Status: ✅  Deploy successful!
Preview URL: https://1f0384c3.usrse-github-io.pages.dev
Branch Preview URL: https://cdcore09-forms-implementatio.usrse-github-io.pages.dev

View logs

@cdcore09 cdcore09 merged commit c95be2e into cdcore09/site-redesign May 29, 2026
2 of 3 checks passed
@cdcore09 cdcore09 deleted the cdcore09/forms-implementation branch May 29, 2026 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant