Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
Iamsidar07 and coderabbitai[bot] authored Aug 21, 2024
1 parent aea9a7e commit 17bb22a
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 19 deletions.
8 changes: 4 additions & 4 deletions packages/api/src/crm/contact/services/leadsquared/mappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class LeadSquaredContactMapper implements IContactMapper {
if (primaryPhone && source.phone_numbers?.[0]?.phone_type == 'MOBILE') {
result.Mobile = primaryPhone;
}
if (source.addresses && source.addresses[0]) {
if (source.addresses?.[0]) {
result.Account_Street1 = source.addresses[0].street_1;
result.Account_City = source.addresses[0].city;
result.Account_State = source.addresses[0].state;
Expand Down Expand Up @@ -109,7 +109,7 @@ export class LeadSquaredContactMapper implements IContactMapper {
}
// Constructing email and phone details
const email_addresses =
contact && contact.EmailAddress
contact?.EmailAddress
? [
{
email_address: contact.EmailAddress,
Expand All @@ -132,13 +132,13 @@ export class LeadSquaredContactMapper implements IContactMapper {
phone_type: 'MOBILE',
});
}
if (contact && contact.Account_Fax) {
if (contact?.Account_Fax) {
phone_numbers.push({
phone_number: contact.Account_Fax,
phone_type: 'fax',
});
}
if (contact && contact.Phone) {
if (contact?.Phone) {
phone_numbers.push({
phone_number: contact.Phone,
phone_type: 'home',
Expand Down
12 changes: 6 additions & 6 deletions packages/api/src/crm/contact/services/leadsquared/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ type LeadSquaredContact = {
[key: string]: string | number | boolean | null;
};

type LeadProperty = {
Attribute: string;
Value: string;
};

export type LeadSquaredContactResponse = {
LeadPropertyList: [
{
Attribute: string;
Value: string;
},
];
LeadPropertyList: LeadProperty[];
};

export type LeadSquaredContactInput = Partial<LeadSquaredContact>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ export class LeadSquaredEngagementMapper implements IEngagementMapper {
Direction: source.direction === 'INBOUND' ? 'Inbound' : 'Outbound',
CallerSource: source.content || '',
LeadId: source.company_id || '',
SourceNumber: '+91-8611795988', // todo,
DisplayNumber: '+91-8611795989', // todo
DestinationNumber: '+91-9611795983', // todo,
SourceNumber: source.source_number || '',
DisplayNumber: source.display_number || '',
DestinationNumber: source.destination_number || '',
};

if (source.start_at && source.end_time) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
interface KeyValuePair {
[key: string]: unknown;
}
type KeyValuePair = Record<string, unknown>;

export type LeadSquaredEngagementCall = {
SourceNumber: string; //'+91-8611795988';
Expand Down
10 changes: 10 additions & 0 deletions packages/api/src/crm/task/services/leadsquared/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ export class LeadSquaredService implements ITaskService {
CrmObject.task,
ActionType.POST,
);
return {
data: null,
message: 'Failed to create Leadsquared task',
statusCode: 500,
};
}
}

Expand Down Expand Up @@ -123,6 +128,11 @@ export class LeadSquaredService implements ITaskService {
CrmObject.task,
ActionType.POST,
);
return {
data: [],
message: 'Failed to retrieve Leadsquared tasks',
statusCode: 500,
};
}
}
}
4 changes: 1 addition & 3 deletions packages/api/src/crm/task/services/leadsquared/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
interface KeyValuePair {
[key: string]: unknown;
}
type KeyValuePair = Record<string, unknown>;

interface LeadSquaredTask {
UserTaskId: string;
Expand Down

0 comments on commit 17bb22a

Please sign in to comment.