Repository navigation
Closed
Description
Context
SahajCloud PR sydevs/SahajCloud#594 (issue #588) adds a manager-facing registration-notification email that forwards the registrant's answers to the event's registration questions. As part of it, the Registrations.questions field is now typed and validated on SahajCloud:
- Keys must be members of
EVENT_REGISTRATION_QUESTIONS:priorExperience,referralSource,healthInfo,accessibility,guests. - Values must be strings.
- A non-conforming payload throws a
ValidationError, whichPOST /api/events/:id/registersurfaces as a400(previously the blob was stored unvalidated).
This ticket is to confirm the widget's questions payload matches that contract before it ships, so live registrations don't start 400-ing.
What the widget does today (looks aligned ✅)
From a read of this repo:
src/views/RegistrationView/RegistrationView.tsx—enabledQuestions(event)derives the enabled question names fromevent.registrationQuestions(Object.entries(...).filter(enabled).map(([key]) => key)) and passes them as thequestionsprop.src/components/organisms/RegistrationForm/RegistrationForm.tsx— registers each field asquestions.<name>(and localises viat('questions.<name>')).src/config/api/mutate.ts— submitsquestions: data.questions.src/types/event.ts—RegistrationQuestionsSchemauses exactlypriorExperience/referralSource/healthInfo/accessibility/guests.
So the widget already appears to send { <question name>: <string answer> } keyed by the EVENT_REGISTRATION_QUESTIONS names — which matches the new SahajCloud contract.
Please confirm / consider
- Keys — confirm nothing other than the five
EVENT_REGISTRATION_QUESTIONSnames can ever end up in the submittedquestionsobject. - Values — confirm answers are always strings.
src/types/registration.tscurrently types this loosely asquestions: z.record(z.string()).optional(); consider tightening the key set to the known names for client-side validation + type safety. - Unanswered enabled questions — does the form submit empty strings or omit the key? Both are accepted by SahajCloud (an empty string is valid, and blank answers are dropped from the notification email), but worth confirming the intended UX.
- Stale generated types —
src/types/payload/payload-types.tsandsrc/types/payload/openapi.jsonstill describequestionswith the old placeholder keys ("questions / experience / aspirations / referral"). Regenerating against the updated SahajCloud OpenAPI (once #594 merges) will refresh that description.
References
- SahajCloud enforcement:
src/collections/Events/eventOptions.ts(RegistrationQuestionstype +validateRegistrationQuestions), wired onto thequestionsfield insrc/collections/Registrations/Registrations.ts. - SahajCloud PR: feat(events): manager registration notifications + per-event routing SahajCloud#594
🤖 Filed with Claude Code on behalf of the SahajCloud #588 work.
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Hold Until
None yet
Activity
refactor(registration): align questions payload with EVENT_REGISTRATI…