Step 12 - content request forms
1 min read
Form builder
Build a form definition feature at /kanban/forms. Collection kanbanForms/{formId}: { id, workspaceId, ownerId, name, pages: {id, title, sections[]}[], isDeleted, createdAt, updatedAt }. A section is { id, type, label, required?, maxStars?, columns?[] } with 13 types: title (display-only heading), description (display-only text), shortText, longText (markdown answer), files, signature, email, url, date, rating (maxStars 1-10), table (up to 10 column headers), color, dateRange.
The list screen shows the workspace's forms with create/rename/soft-delete. The builder at /kanban/forms/:formId edits one form: add/remove/reorder pages (move left/right), and within a page an ordered section list with a palette of the 13 types, per-section label, required toggle, move up/down, remove; type-specific config (star count for rating, column headers for table). Autosave the definition with a debounce and a saving/saved indicator.
Send a request from a card
Add "Request content" to the task panel. The user picks one of the workspace's forms, enters a recipient email (regex-validated) and an optional deadline, and sends. This creates kanbanFormRequests/{requestId} where the DOC ID itself is the unguessable public-link token (uid + extra random chars): { workspaceId, projectId, taskId, formId, formName, pages (a FROZEN deep-copy snapshot of the form's pages - later edits to the form must not affect sent requests), taskTitle, recipientEmail, requesterUid, requesterName, language, status: 'pending', dueAt?, answers?: {} (keyed by sectionId), fieldStates?: {}, pageStates?: {}, createdAt, updatedAt }.
Security rules: get allowed for any signed-in user (the link IS the credential) but LIST only for workspace members, so recipient emails and answers cannot be enumerated. Recipient updates are restricted with diff().affectedKeys().hasOnly(['answers','fieldStates','pageStates','status','completedAt','updatedAt']). In the task panel, show the card's sent requests with status chips and a copy-link action. Add a Cloud Function onDocumentCreated that emails the recipient the public link /kanban/form/{requestId} with the requester's name and the task title.
Discussion
0 commentsNo comments yet. Start the discussion.