Skip to content

Commit

Permalink
Update queryBapFor2023PRFData() to query the bus records contacts acc…
Browse files Browse the repository at this point in the history
…ounts data too (for the org address info, since it's not included on the bus records contacts themselves)
  • Loading branch information
courtneymyers committed Mar 27, 2024
1 parent 1dee04c commit 7e48691
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions app/server/app/utilities/bap.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,15 @@ const { submissionPeriodOpen } = require("../config/formio");
* } | null
* }[]} frf2023BusRecordsContactsQueries
* @property {{
* Id: string
* Name: string
* BillingStreet: string
* BillingCountry: string
* BillingCity: string
* BillingState: string
* BillingPostalCode: string
* }[]} frf2023BusRecordsContactsOrgsQueries
* @property {{
* type: string
* url: string
* }} attributes
Expand Down Expand Up @@ -1030,10 +1039,23 @@ async function queryBapFor2023PRFData(req, frfReviewItemId) {
)
).flat();

const frf2023BusRecordsContactsAccountIds = [
...new Set(
frf2023BusRecordsContactsQueries.map((item) => item.Contact__r.AccountId),
),
];

const frf2023BusRecordsContactsOrgsQueries = await bapConnection
.sobject("Account")
.retrieve(frf2023BusRecordsContactsAccountIds, async (err, records) =>
(await err) ? err : records,
);

return {
frf2023RecordQuery,
frf2023BusRecordsQuery,
frf2023BusRecordsContactsQueries,
frf2023BusRecordsContactsOrgsQueries,
};
}

Expand Down

0 comments on commit 7e48691

Please sign in to comment.