Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
fix: Return event details upon creation (#512)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashutosh-revert authored Mar 11, 2024
1 parent 3c637e4 commit 002f116
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
33 changes: 20 additions & 13 deletions packages/backend/services/crm/contact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -832,19 +832,26 @@ const contactService = new ContactService(
authorization: `Zoho-oauthtoken ${thirdPartyToken}`,
},
});
contacts = contacts.data.data;
contacts = await Promise.all(
contacts?.map(
async (l: any) =>
await unifyObject<any, UnifiedContact>({
obj: l,
tpId: thirdPartyId,
objType,
tenantSchemaMappingId: connection.schema_mapping_id,
accountFieldMappingConfig: account.accountFieldMappingConfig,
})
)
);
const isValidContactData =
contacts.data && contacts.data.data !== undefined && Array.isArray(contacts.data.data);
if (isValidContactData) {
contacts = contacts?.data?.data;

contacts = await Promise.all(
contacts?.map(
async (l: any) =>
await unifyObject<any, UnifiedContact>({
obj: l,
tpId: thirdPartyId,
objType,
tenantSchemaMappingId: connection.schema_mapping_id,
accountFieldMappingConfig: account.accountFieldMappingConfig,
})
)
);
} else {
contacts = [];
}
res.send({ status: 'ok', results: contacts });
break;
}
Expand Down
8 changes: 6 additions & 2 deletions packages/backend/services/crm/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,15 +469,19 @@ const eventService = new EventService(
break;
}
case TP_ID.zohocrm: {
await axios({
const eventCreated: any = await axios({
method: 'post',
url: `https://www.zohoapis.com/crm/v3/Events`,
headers: {
authorization: `Zoho-oauthtoken ${thirdPartyToken}`,
},
data: JSON.stringify(event),
});
res.send({ status: 'ok', message: 'Zoho event created', result: event });
res.send({
status: 'ok',
message: 'Zoho event created',
result: { ...event, details: eventCreated.data.data[0].details },
});
break;
}
case TP_ID.sfdc: {
Expand Down

0 comments on commit 002f116

Please sign in to comment.