Skip to content

feat: include visit registration questionary answers in visit messages - #1740

Open
janosbabik wants to merge 1 commit into
developfrom
feat_visit_msg_payload_with_questions
Open

feat: include visit registration questionary answers in visit messages#1740
janosbabik wants to merge 1 commit into
developfrom
feat_visit_msg_payload_with_questions

Conversation

@janosbabik

Copy link
Copy Markdown
Contributor

Adds visit registration questionary answers to visit message payloads using question natural keys.

New payload format:

{
  "id": "visit-registration-id",
  "startAt": "2026-08-24T08:00:00.000Z",
  "endAt": "2026-08-24T16:00:00.000Z",
  "visitorId": "123",
  "proposal": {...},
  "registrationAnswers": [
    {
      "questionNaturalKey": "request_daily_allowance",
      "value": true
    },
    ...
  ]
}

@janosbabik
janosbabik requested a review from a team as a code owner August 24, 2026 10:03
@janosbabik
janosbabik requested review from Jonathan-Swales and jekabs-karklins and removed request for a team and Jonathan-Swales August 24, 2026 10:03

@jekabs-karklins jekabs-karklins left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - I left a commend on messagebroker WDYT.

Comment on lines +354 to +361
registrationAnswers.push(
...questionarySteps.flatMap((step) =>
step.fields.map((field) => ({
questionNaturalKey: field.question.naturalKey,
value: field.value,
}))
)
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
registrationAnswers.push(
...questionarySteps.flatMap((step) =>
step.fields.map((field) => ({
questionNaturalKey: field.question.naturalKey,
value: field.value,
}))
)
);
registrationAnswers.push(
...questionarySteps.flatMap((step) =>
step.fields
.filter((field) =>
areDependenciesSatisfied(questionarySteps, field.question.id)
)
.map((field) => ({
questionNaturalKey: field.question.naturalKey,
value: field.value,
}))
)
);

Can we add this check already, to make sure in case we introduce questions with dependencies the unanswered questions get filtered out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants