-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved synchronization service for all entities. #336
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe changes involve updating various service mappers and sync services in the API to include a Changes
Assessment against linked issues
Possibly related issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 14
Configuration used: CodeRabbit UI
Files selected for processing (60)
- packages/api/src/crm/company/services/attio/mappers.ts (2 hunks)
- packages/api/src/crm/company/services/hubspot/mappers.ts (2 hunks)
- packages/api/src/crm/company/services/pipedrive/mappers.ts (1 hunks)
- packages/api/src/crm/company/services/zendesk/mappers.ts (2 hunks)
- packages/api/src/crm/company/services/zoho/mappers.ts (1 hunks)
- packages/api/src/crm/company/sync/sync.service.ts (2 hunks)
- packages/api/src/crm/contact/services/attio/mappers.ts (1 hunks)
- packages/api/src/crm/contact/services/freshsales/mappers.ts (1 hunks)
- packages/api/src/crm/contact/services/hubspot/mappers.ts (1 hunks)
- packages/api/src/crm/contact/services/pipedrive/mappers.ts (1 hunks)
- packages/api/src/crm/contact/services/zendesk/mappers.ts (1 hunks)
- packages/api/src/crm/contact/services/zoho/mappers.ts (1 hunks)
- packages/api/src/crm/contact/sync/sync.service.ts (2 hunks)
- packages/api/src/crm/deal/services/hubspot/mappers.ts (1 hunks)
- packages/api/src/crm/deal/services/pipedrive/mappers.ts (1 hunks)
- packages/api/src/crm/deal/services/zendesk/mappers.ts (1 hunks)
- packages/api/src/crm/deal/services/zoho/mappers.ts (1 hunks)
- packages/api/src/crm/deal/sync/sync.service.ts (2 hunks)
- packages/api/src/crm/engagement/services/hubspot/mappers.ts (4 hunks)
- packages/api/src/crm/engagement/services/pipedrive/mappers.ts (1 hunks)
- packages/api/src/crm/engagement/services/zendesk/mappers.ts (1 hunks)
- packages/api/src/crm/engagement/sync/sync.service.ts (2 hunks)
- packages/api/src/crm/note/services/hubspot/mappers.ts (1 hunks)
- packages/api/src/crm/note/services/pipedrive/mappers.ts (1 hunks)
- packages/api/src/crm/note/services/zendesk/mappers.ts (1 hunks)
- packages/api/src/crm/note/services/zoho/mappers.ts (1 hunks)
- packages/api/src/crm/note/sync/sync.service.ts (2 hunks)
- packages/api/src/crm/stage/services/hubspot/mappers.ts (1 hunks)
- packages/api/src/crm/stage/services/pipedrive/mappers.ts (1 hunks)
- packages/api/src/crm/stage/services/zendesk/mappers.ts (1 hunks)
- packages/api/src/crm/stage/sync/sync.service.ts (3 hunks)
- packages/api/src/crm/task/services/hubspot/mappers.ts (2 hunks)
- packages/api/src/crm/task/services/pipedrive/mappers.ts (1 hunks)
- packages/api/src/crm/task/services/zendesk/mappers.ts (1 hunks)
- packages/api/src/crm/task/sync/sync.service.ts (2 hunks)
- packages/api/src/crm/user/services/hubspot/mappers.ts (1 hunks)
- packages/api/src/crm/user/services/pipedrive/mappers.ts (1 hunks)
- packages/api/src/crm/user/services/zendesk/mappers.ts (1 hunks)
- packages/api/src/crm/user/sync/sync.service.ts (2 hunks)
- packages/api/src/ticketing/account/services/front/mappers.ts (1 hunks)
- packages/api/src/ticketing/account/services/zendesk/mappers.ts (1 hunks)
- packages/api/src/ticketing/account/sync/sync.service.ts (2 hunks)
- packages/api/src/ticketing/comment/services/front/mappers.ts (1 hunks)
- packages/api/src/ticketing/comment/services/zendesk/mappers.ts (1 hunks)
- packages/api/src/ticketing/comment/sync/sync.service.ts (3 hunks)
- packages/api/src/ticketing/contact/services/front/mappers.ts (1 hunks)
- packages/api/src/ticketing/contact/services/zendesk/mappers.ts (1 hunks)
- packages/api/src/ticketing/contact/sync/sync.service.ts (3 hunks)
- packages/api/src/ticketing/tag/services/zendesk/mappers.ts (1 hunks)
- packages/api/src/ticketing/tag/sync/sync.service.ts (3 hunks)
- packages/api/src/ticketing/team/services/front/mappers.ts (1 hunks)
- packages/api/src/ticketing/team/services/zendesk/mappers.ts (1 hunks)
- packages/api/src/ticketing/team/sync/sync.service.ts (2 hunks)
- packages/api/src/ticketing/ticket/services/front/mappers.ts (2 hunks)
- packages/api/src/ticketing/ticket/services/hubspot/mappers.ts (1 hunks)
- packages/api/src/ticketing/ticket/services/zendesk/mappers.ts (1 hunks)
- packages/api/src/ticketing/ticket/sync/sync.service.ts (2 hunks)
- packages/api/src/ticketing/user/services/front/mappers.ts (1 hunks)
- packages/api/src/ticketing/user/services/zendesk/mappers.ts (1 hunks)
- packages/api/src/ticketing/user/sync/sync.service.ts (2 hunks)
Additional comments (53)
packages/api/src/ticketing/team/services/front/mappers.ts (1)
- 42-42: The addition of
remote_id: team.id
aligns with the PR objectives and should ensure better synchronization by directly linking the original source objects with their unified counterparts. Please verify that the type ofteam.id
is consistent with the expected type forremote_id
to avoid any type mismatch issues.packages/api/src/ticketing/team/services/zendesk/mappers.ts (1)
- 42-42: Setting
remote_id
by concatenatingteam.id
with an empty string ensures it's treated as a string. This change aligns with the PR objectives. Ifteam.id
is always a string, the concatenation might be unnecessary, but if it's for consistency or type assurance across different services, it's understandable.packages/api/src/ticketing/account/services/zendesk/mappers.ts (1)
- 42-42: The inclusion of
remote_id: account.id + ""
ensuresremote_id
is treated as a string, aligning with the PR's goal of improving synchronization. As with the previous files, if the concatenation is for type assurance or consistency, it's a sensible approach.packages/api/src/crm/stage/services/zendesk/mappers.ts (1)
- 49-49: Adding
remote_id: stage.id + ""
for stage mapping is consistent with the PR's objectives and the approach taken in other mappers. This ensuresremote_id
is always treated as a string, contributing to the system's data integrity.packages/api/src/crm/stage/services/hubspot/mappers.ts (1)
- 47-47: Directly setting
remote_id: stage.id
in the Hubspot stage mapper simplifies the implementation and aligns with the PR's objectives. This approach suggestsstage.id
is already in the desired format, which is beneficial for consistency and simplicity.packages/api/src/crm/user/services/hubspot/mappers.ts (1)
- 48-48: Setting
remote_id: user.id
directly in the Hubspot user mapper aligns with the PR's objectives, ensuring a straightforward and consistent mapping process. This approach indicates thatuser.id
is in the appropriate format, simplifying the implementation.packages/api/src/crm/stage/services/pipedrive/mappers.ts (1)
- 49-49: The inclusion of
remote_id: stage.id + ""
in the Pipedrive stage mapper ensuresremote_id
is treated as a string, aligning with the PR's objectives. This concatenation approach, used for consistency or type assurance, is understandable.packages/api/src/ticketing/user/services/zendesk/mappers.ts (1)
- 46-46: Adding
remote_id: user.id + ""
in the Zendesk user mapper is consistent with the PR's objectives, ensuringremote_id
is treated as a string. This approach, used across different mappers for consistency or type assurance, is sensible.packages/api/src/ticketing/user/services/front/mappers.ts (1)
- 46-46: The addition of the
remote_id
field correctly aligns with the PR objectives, ensuring theremote_id
is set based on the source object's ID.packages/api/src/ticketing/tag/services/zendesk/mappers.ts (1)
- 41-41: The addition of the
id
field with a specific format forUnifiedTagOutput
is a significant change. It's important to ensure that this format does not conflict with any existing ID formats and that it's properly documented, especially since it's noted as a temporary measure.Ensure that the use of this format does not conflict with existing ID management strategies and that it's clearly documented as a temporary measure.
packages/api/src/ticketing/account/services/front/mappers.ts (1)
- 46-46: The addition of the
remote_id
field is consistent with the PR objectives, ensuring direct linkage between source and unified objects.packages/api/src/ticketing/contact/services/zendesk/mappers.ts (1)
- 46-46: Adding the
remote_id
field by converting the contact'sid
to a string is a good practice for ensuring type consistency across the system.packages/api/src/ticketing/contact/services/front/mappers.ts (1)
- 52-52: The addition of the
remote_id
field to theUnifiedContactOutput
object is correctly implemented, ensuring a direct link between the source and unified objects.packages/api/src/crm/user/services/zendesk/mappers.ts (1)
- 63-63: The addition of the
remote_id
field, converting the user'sid
to a string, ensures consistency and proper linkage in the system.packages/api/src/crm/user/services/pipedrive/mappers.ts (1)
- 63-63: The addition of the
remote_id
field to theUnifiedUserOutput
object aligns with the PR's objectives, ensuring a direct linkage between source and unified objects.packages/api/src/crm/deal/services/zoho/mappers.ts (1)
- 64-65: The comment
//TODO - might be wrong deal.Owner
suggests uncertainty about the source ofremote_id
. It's crucial to verify thatdeal.Owner
is the correct property forremote_id
to ensure data integrity.packages/api/src/crm/contact/services/freshsales/mappers.ts (1)
- 69-69: Consider using
String(contact.id)
for convertingcontact.id
to a string. It makes the intention clearer than usingcontact.id + ""
.packages/api/src/crm/note/services/hubspot/mappers.ts (1)
- 92-92: The addition of
remote_id
with the value ofnote.id
correctly aligns with the PR's objectives to ensure proper synchronization.packages/api/src/ticketing/ticket/services/hubspot/mappers.ts (1)
- 67-67: The addition of
remote_id
with the value ofticket.id
is correctly implemented. However, there are existing TODO comments related toname
anddescription
fields that should be addressed in future updates.packages/api/src/ticketing/comment/services/front/mappers.ts (1)
- 87-87: The addition of
remote_id
to theres
object is correctly implemented and aligns with the PR's objectives for synchronization.packages/api/src/crm/deal/services/pipedrive/mappers.ts (1)
- 112-112: The addition of
remote_id
with the value ofdeal.id
is correctly implemented and aligns with the PR's objectives to ensure proper synchronization.packages/api/src/crm/company/services/zoho/mappers.ts (1)
- 73-73: The addition of
remote_id
to the return object is correctly implemented and aligns with the PR's objectives for synchronization.packages/api/src/crm/deal/services/hubspot/mappers.ts (1)
- 103-103: The addition of
remote_id
with the value ofdeal.id
is correctly implemented. However, there are existing TODO comments related tostage_id
and other fields that should be addressed in future updates.packages/api/src/crm/note/services/zendesk/mappers.ts (1)
- 117-117: The addition of the
remote_id
field in themapSingleNoteToUnified
method correctly implements the PR's objective to ensureremote_id
is set based on the source object's ID. This change enhances the synchronization process by directly linking the original source objects with their unified counterparts.packages/api/src/crm/contact/services/hubspot/mappers.ts (1)
- 95-96: The addition of the
remote_id
field in themapSingleContactToUnified
method correctly implements the PR's objective to ensureremote_id
is set based on the source object's ID. This change enhances the synchronization process by directly linking the original source objects with their unified counterparts.packages/api/src/ticketing/comment/services/zendesk/mappers.ts (1)
- 98-98: The addition of the
remote_id
field in themapSingleCommentToUnified
method correctly implements the PR's objective to ensureremote_id
is set based on the source object's ID. This change enhances the synchronization process by directly linking the original source objects with their unified counterparts.packages/api/src/crm/note/services/pipedrive/mappers.ts (1)
- 133-133: The addition of the
remote_id
field in themapSingleNoteToUnified
method correctly implements the PR's objective to ensureremote_id
is set based on the source object's ID. This change enhances the synchronization process by directly linking the original source objects with their unified counterparts.packages/api/src/crm/deal/services/zendesk/mappers.ts (1)
- 125-125: The addition of the
remote_id
field in themapSingleDealToUnified
method correctly implements the PR's objective to ensureremote_id
is set based on the source object's ID. This change enhances the synchronization process by directly linking the original source objects with their unified counterparts.packages/api/src/crm/company/services/pipedrive/mappers.ts (1)
- 93-93: The addition of the
remote_id
field in themapSingleCompanyToUnified
method correctly implements the PR's objective to ensureremote_id
is set based on the source object's ID. This change enhances the synchronization process by directly linking the original source objects with their unified counterparts.packages/api/src/ticketing/ticket/services/front/mappers.ts (1)
- 118-118: The addition of the
remote_id
field in themapSingleTicketToUnified
method correctly implements the PR's objective to ensureremote_id
is set based on the source object's ID. This change enhances the synchronization process by directly linking the original source objects with their unified counterparts.packages/api/src/crm/contact/services/zoho/mappers.ts (1)
- 121-121: The addition of the
remote_id
field in themapSingleContactToUnified
method correctly implements the PR's objective to ensureremote_id
is set based on the source object's ID. This change enhances the synchronization process by directly linking the original source objects with their unified counterparts.packages/api/src/crm/task/services/zendesk/mappers.ts (1)
- 138-138: The addition of
remote_id: task.id,
in theunify
method correctly implements the PR's objective by ensuring theremote_id
is set based on the source object's ID. This change should streamline the synchronization process as intended.packages/api/src/crm/company/services/hubspot/mappers.ts (1)
- 112-112: Adding
remote_id: company.id,
and setting a placeholder value fornumber_of_employees
in theunify
method aligns with the PR's objective. However, ensure that the placeholder fornumber_of_employees
is eventually replaced with actual logic to retrieve the correct value.packages/api/src/crm/task/services/pipedrive/mappers.ts (2)
- 136-136: Adding
remote_id: task.id,
in theunify
method correctly implements the PR's objective by ensuring theremote_id
is set based on the source object's ID. This change should streamline the synchronization process as intended.- 140-141: The adjustment in formatting for the
due_date
assignment enhances readability and clarity. This change ensures that thedue_date
is correctly handled and assigned, aligning with the PR's objective to improve data integrity.packages/api/src/crm/contact/services/pipedrive/mappers.ts (1)
- 124-124: The addition of
remote_id: contact.id,
in theunify
method correctly implements the PR's objective by ensuring theremote_id
is set based on the source object's ID. This change should streamline the synchronization process as intended.packages/api/src/crm/task/services/hubspot/mappers.ts (1)
- 94-94: Adding
remote_id: task.id,
in theunify
method correctly implements the PR's objective by ensuring theremote_id
is set based on the source object's ID. This change should streamline the synchronization process as intended.packages/api/src/crm/engagement/services/zendesk/mappers.ts (1)
- 141-141: The addition of
remote_id: engagement.id,
in theunify
method correctly implements the PR's objective by ensuring theremote_id
is set based on the source object's ID. This change should streamline the synchronization process as intended.packages/api/src/crm/contact/services/zendesk/mappers.ts (1)
- 135-135: The addition of
remote_id: contact.id + "",
in theunify
method correctly implements the PR's objective. However, the concatenation operation to convertcontact.id
to a string seems unnecessary ifcontact.id
is already a string. Ifcontact.id
is not a string, this approach is valid, but it would be more clear to use a more explicit conversion method.Consider using
String(contact.id)
for explicit conversion to a string if necessary.packages/api/src/crm/company/services/zendesk/mappers.ts (2)
- 14-14: The TODO comment indicates that Zendesk does not have a Company object, which raises questions about the implementation of the
ZendeskCompanyMapper
. It's crucial to ensure that the mapping logic aligns with the capabilities and limitations of the Zendesk API.- 140-140: Adding
remote_id: company.id,
in theunify
method correctly implements the PR's objective by ensuring theremote_id
is set based on the source object's ID. This change should streamline the synchronization process as intended.packages/api/src/crm/contact/services/attio/mappers.ts (2)
- 120-120: Adding a
console.log
statement directly into production code can lead to potential performance issues and cluttered log files, especially if the log is not providing critical information.Consider removing the
console.log
statement or replacing it with a more structured logging approach that allows for log level control.
- 123-123: The addition of
remote_id
directly addresses the issue of undefined or nullremote_ids
by ensuring that the ID is extracted and assigned during the unification process.This change effectively streamlines the synchronization process and enhances data integrity.
packages/api/src/ticketing/ticket/services/zendesk/mappers.ts (1)
- 146-146: The addition of
remote_id
to theUnifiedTicketOutput
object is a crucial improvement.This change ensures that the original ticket ID from Zendesk is preserved in the unified object, enhancing traceability and data integrity.
packages/api/src/crm/company/services/attio/mappers.ts (1)
- 144-144: The addition of
remote_id
directly fromcompany.id?.record_id
is a significant improvement.This ensures that the original company ID from Attio is preserved in the unified object, which is crucial for maintaining data integrity and traceability.
packages/api/src/crm/engagement/services/pipedrive/mappers.ts (1)
- 177-177: The addition of
remote_id
to the unified engagement object is a positive change.This ensures that the original engagement ID from Pipedrive is accurately reflected in the unified object, enhancing data integrity and traceability.
packages/api/src/crm/deal/sync/sync.service.ts (1)
- 181-181: The assignment of
originId
directly fromdeal.remote_id
is correct and aligns with the intended changes described in the PR objectives. This approach simplifies the logic by eliminating the need for a separate array to store deal IDs.packages/api/src/crm/engagement/services/hubspot/mappers.ts (4)
- 194-195: The union types for
HubspotEngagementMeetingOutput
have been adjusted. This change is approved as it seems to correct the type to allow for both single and array inputs, enhancing the flexibility of theunifyMeeting
method.- 201-202: Similarly, the union types for
HubspotEngagementEmailOutput
have been adjusted to allow for both single and array inputs. This is a positive change that increases the method's versatility in handling different input types.- 299-299: The addition of
remote_id
mapping for engagement ID in themapSingleEngagementCallToUnified
method is a crucial improvement. It directly addresses the PR's objective by ensuring that theremote_id
is set based on the source object's ID, which is essential for maintaining a link between the original and unified objects.- 382-383: The ternary operator for email direction mapping in the
mapSingleEngagementEmailToUnified
method has been corrected to maphs_email_direction
to'INBOUND'
or'OUTBOUND'
, depending on the HubSpot engagement email output. This change is consistent with the PR's objective and improves the accuracy of the direction mapping.packages/api/src/ticketing/comment/sync/sync.service.ts (1)
- 209-215: The refinement of
opts
assignment based oncomment.creator_type
is a good practice, ensuring that the correct ID is assigned based on the creator type. This change enhances the clarity and maintainability of the code by using a more structured approach to handle different creator types.packages/api/src/crm/contact/sync/sync.service.ts (1)
- 196-196: The direct use of
contact.remote_id
fororiginId
assignment in thesaveContactsInDb
method is correct and aligns with the PR's objectives. This change ensures that theremote_id
is directly used, addressing the issue of previously undefined or nullremote_ids
.
@@ -201,7 +196,7 @@ export class SyncService implements OnModuleInit { | |||
let stages_results: CrmStage[] = []; | |||
for (let i = 0; i < stages.length; i++) { | |||
const stage = stages[i]; | |||
const originId = originIds[i]; | |||
const originId = stage.remote_id[i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using stage.remote_id[i]
to access the originId
assumes that the index i
in the loop over stages
directly corresponds to the correct remote_id
for each stage. This approach is error-prone because it relies on the order of stages
and their remote_id
s being perfectly aligned, which might not always be the case, especially if the data undergoes any transformations or filtering that could affect the order.
A more robust approach would be to directly use stage.remote_id
without indexing it, ensuring that the correct remote_id
is always used for each stage object.
- const originId = stage.remote_id[i];
+ const originId = stage.remote_id;
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
const originId = stage.remote_id[i]; | |
const originId = stage.remote_id; |
originSource: string, | ||
remote_data: Record<string, any>[], | ||
): Promise<CrmEngagement[]> { | ||
try { | ||
let engagements_results: CrmEngagement[] = []; | ||
for (let i = 0; i < engagements.length; i++) { | ||
const engagement = engagements[i]; | ||
const originId = originIds[i]; | ||
const originId = engagement.remote_id[i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the issue identified in the stage
synchronization service, using engagement.remote_id[i]
to access the originId
assumes that the index i
in the loop over engagements
directly corresponds to the correct remote_id
for each engagement. This approach is error-prone because it relies on the order of engagements
and their remote_id
s being perfectly aligned, which might not always be the case.
A more robust approach would be to directly use engagement.remote_id
without indexing it, ensuring that the correct remote_id
is always used for each engagement object.
- const originId = engagement.remote_id[i];
+ const originId = engagement.remote_id;
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
const originId = engagement.remote_id[i]; | |
const originId = engagement.remote_id; |
? 'FORWARDED_EMAIL' | ||
: '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ternary operator for hs_email_direction
has been updated to map source.direction
to 'FORWARDED_EMAIL'
for 'OUTBOUND'
emails. However, this seems to be a logical error since outbound emails should not be mapped to 'FORWARDED_EMAIL'
. Instead, they should likely be mapped to a different HubSpot-specific value that accurately represents outbound emails.
- ? 'FORWARDED_EMAIL'
+ ? 'OUTBOUND_EMAIL' // Assuming 'OUTBOUND_EMAIL' is the correct mapping, please replace with the correct HubSpot value.
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
? 'FORWARDED_EMAIL' | |
: '', | |
? 'OUTBOUND_EMAIL' // Assuming 'OUTBOUND_EMAIL' is the correct mapping, please replace with the correct HubSpot value. | |
: '', |
@@ -192,7 +188,7 @@ export class SyncService implements OnModuleInit { | |||
let comments_results: TicketingComment[] = []; | |||
for (let i = 0; i < comments.length; i++) { | |||
const comment = comments[i]; | |||
const originId = originIds[i]; | |||
const originId = comment.remote_id[i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assignment of originId
using comment.remote_id[i]
is incorrect. The use of the index i
with remote_id
suggests that remote_id
is being treated as an array, which is likely not the case. remote_id
should be directly assigned without indexing.
- const originId = comment.remote_id[i];
+ const originId = comment.remote_id;
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
const originId = comment.remote_id[i]; | |
const originId = comment.remote_id; |
@@ -197,7 +192,7 @@ export class SyncService implements OnModuleInit { | |||
let tags_results: TicketingTag[] = []; | |||
for (let i = 0; i < tags.length; i++) { | |||
const tag = tags[i]; | |||
const originId = originIds[i]; | |||
const originId = tag.remote_id[i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assignment of originId
using tag.remote_id[i]
seems incorrect. The index i
should not be used with remote_id
as it's not an array but a property of the tag
object.
- const originId = tag.remote_id[i];
+ const originId = tag.remote_id;
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
const originId = tag.remote_id[i]; | |
const originId = tag.remote_id; |
originSource: string, | ||
remote_data: Record<string, any>[], | ||
): Promise<TicketingTicket[]> { | ||
try { | ||
let tickets_results: TicketingTicket[] = []; | ||
for (let i = 0; i < tickets.length; i++) { | ||
const ticket = tickets[i]; | ||
const originId = originIds[i]; | ||
const originId = ticket.remote_id[i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assignment of originId
using ticket.remote_id[i]
seems incorrect. The index i
should not be used with remote_id
as it's not an array but a property of the ticket
object.
- const originId = ticket.remote_id[i];
+ const originId = ticket.remote_id;
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
const originId = ticket.remote_id[i]; | |
const originId = ticket.remote_id; |
@@ -43,6 +43,7 @@ export class FrontUserMapper implements IUserMapper { | |||
})); | |||
|
|||
const unifiedUser: UnifiedUserOutput = { | |||
remote_id: user.id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a semantic error in the assignment of the name
field, where last_name
is used twice instead of using both first_name
and last_name
.
- name: `${user.last_name} ${user.last_name}`,
+ name: `${user.first_name} ${user.last_name}`,
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
remote_id: user.id, | |
remote_id: user.id, |
//TODO | ||
remote_id: note.Owner, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The addition of the remote_id
field is noted with a //TODO
comment, indicating unfinished work or a placeholder for future implementation. It's important to address or clarify this TODO before merging to ensure the code is complete and functional.
Would you like assistance in addressing this TODO, or should it be tracked as an issue for future resolution?
@@ -126,6 +126,8 @@ export class AttioCompanyMapper implements ICompanyMapper { | |||
|
|||
let opts: any = {}; | |||
|
|||
|
|||
//TODO - Logic needs to be reconsider |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TODO comment indicates a need for reconsidering logic related to company.values.team[0]?.target_record_id
.
Would you like assistance in addressing this TODO? It's important to ensure that the logic aligns with the intended functionality and data integrity requirements.
@@ -95,6 +95,7 @@ export class HubspotCompanyMapper implements ICompanyMapper { | |||
})) || []; | |||
|
|||
let opts: any = {}; | |||
//TODO - Logic needs to be reconsider |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TODO comment about reconsidering logic indicates an area that may need further attention or refinement. It's important to ensure that any logic related to owner ID mapping is correctly implemented and does not introduce inconsistencies.
Would you like me to help refine this logic or open a GitHub issue to track this task?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (13)
- packages/api/src/crm/company/sync/sync.service.ts (2 hunks)
- packages/api/src/crm/engagement/sync/sync.service.ts (2 hunks)
- packages/api/src/crm/note/sync/sync.service.ts (2 hunks)
- packages/api/src/crm/stage/sync/sync.service.ts (3 hunks)
- packages/api/src/crm/task/sync/sync.service.ts (2 hunks)
- packages/api/src/crm/user/sync/sync.service.ts (2 hunks)
- packages/api/src/ticketing/account/sync/sync.service.ts (2 hunks)
- packages/api/src/ticketing/comment/sync/sync.service.ts (3 hunks)
- packages/api/src/ticketing/contact/sync/sync.service.ts (3 hunks)
- packages/api/src/ticketing/tag/sync/sync.service.ts (3 hunks)
- packages/api/src/ticketing/team/sync/sync.service.ts (2 hunks)
- packages/api/src/ticketing/ticket/sync/sync.service.ts (2 hunks)
- packages/api/src/ticketing/user/sync/sync.service.ts (2 hunks)
Files skipped from review as they are similar to previous changes (13)
- packages/api/src/crm/company/sync/sync.service.ts
- packages/api/src/crm/engagement/sync/sync.service.ts
- packages/api/src/crm/note/sync/sync.service.ts
- packages/api/src/crm/stage/sync/sync.service.ts
- packages/api/src/crm/task/sync/sync.service.ts
- packages/api/src/crm/user/sync/sync.service.ts
- packages/api/src/ticketing/account/sync/sync.service.ts
- packages/api/src/ticketing/comment/sync/sync.service.ts
- packages/api/src/ticketing/contact/sync/sync.service.ts
- packages/api/src/ticketing/tag/sync/sync.service.ts
- packages/api/src/ticketing/team/sync/sync.service.ts
- packages/api/src/ticketing/ticket/sync/sync.service.ts
- packages/api/src/ticketing/user/sync/sync.service.ts
Summary by CodeRabbit
New Features
remote_id
field across various CRM and ticketing services for better synchronization and mapping of company, contact, deal, engagement, note, stage, task, user, account, comment, contact, tag, team, and ticket entities.Refactor
remote_id
for identifying and saving entities in the database.Bug Fixes