Skip to content

Commit

Permalink
Update campaignMappingUtils.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
ashish-egov authored Jun 18, 2024
1 parent 1ebc6c5 commit e2d971e
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ async function getProjectMappingBody(messageObject: any, boundaryWithProject: an
if (boundaryWithProject[key]) {
const resources: any[] = [];
const pvarIds = getPvarIds(messageObject);
if (pvarIds) {
if (pvarIds && Array.isArray(pvarIds) && pvarIds.length > 0) {
resources.push({
type: "resource",
resourceIds: pvarIds
})
}
for (const type of Object.keys(boundaryCodes)) {
if (boundaryCodes[type][key]) {
if (boundaryCodes[type][key] && Array.isArray(boundaryCodes[type][key]) && boundaryCodes[type][key].length > 0) {
resources.push({
type: type == "user" ? "staff" : type,
resourceIds: [...boundaryCodes[type][key]]
Expand Down Expand Up @@ -143,9 +143,12 @@ async function fetchAndMap(resources: any[], messageObject: any) {
const boundaryCodes: any = {};

await enrichBoundaryCodes(resources, messageObject, boundaryCodes, sheetName);
logger.info("boundaryCodes : " + JSON.stringify(boundaryCodes));
var boundaryWithProject: any = {};
await enrichBoundaryWithProject(messageObject, boundaryWithProject, boundaryCodes);
logger.info("boundaryWithProject : " + JSON.stringify(boundaryWithProject));
const projectMappingBody = await getProjectMappingBody(messageObject, boundaryWithProject, boundaryCodes);
logger.info("projectMappingBody : " + JSON.stringify(projectMappingBody));
logger.info("projectMapping started ");
const projectMappingResponse: any = await createCampaignService(projectMappingBody);
logger.info("Project Mapping Response received");
Expand Down

0 comments on commit e2d971e

Please sign in to comment.