Skip to content

Commit

Permalink
Add callType to prepopulate
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenhand committed Dec 17, 2024
1 parent c59e530 commit 316abb2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion functions/hrm/prepopulateForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,14 @@ type ChannelTypes =
| 'line'
| 'modica';

const callTypes = {
child: 'Child calling about self',
caller: 'Someone calling about a child',
};

type HrmContactRawJson = {
definitionVersion?: string;
callType: string;
callType: typeof callTypes[keyof typeof callTypes];
childInformation: Record<string, FormValue>;
callerInformation: Record<string, FormValue>;
caseInformation: Record<string, FormValue>;
Expand Down Expand Up @@ -410,6 +415,10 @@ export const prepopulateForm = async (

const isValidSurvey = Boolean(answers?.aboutSelf); // determines if the memory has valid values or if it was aborted
const isAboutSelf = answers.aboutSelf === 'Yes';
if (isValidSurvey) {
// eslint-disable-next-line no-param-reassign
contact.rawJson.callType = isAboutSelf ? callTypes.child : callTypes.caller;
}
if (preEngagementData) {
await populateContactSection(
contact.rawJson.caseInformation,
Expand Down

0 comments on commit 316abb2

Please sign in to comment.