Skip to content
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

(ITE-146) Update Segment Engage Destination to handle onDelete events #11

Merged
merged 11 commits into from
Nov 18, 2024

Conversation

illumin04
Copy link

Update Segment Engage Destination to handle onDelete events
A logic rewrite after the new graphQL API.

A summary of your pull request, including the what change you're making and why.

Testing

Include any additional information about the testing you have completed to
ensure your changes behave as expected. For a speedy review, please check
any of the tasks you completed below during your testing.

  • Added unit tests for new functionality
  • Tested end-to-end using the local server
  • [If destination is already live] Tested for backward compatibility of destination. Note: New required fields are a breaking change.
  • [Segmenters] Tested in the staging environment
  • [Segmenters] [If applicable for this change] Tested for regression with Hadron.

const formattedExternalIds = `["${userId}"]`

const syncIds = [sha256hash(String(userId))]
const formattedSyncIds = `[${syncIds.map((syncId: string) => `"${syncId}"`).join(', ')}]`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, we know that there will always only be one syncId, so why put it into an array and map it if the outcome will always just be "${syncId}"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's correct, this was leftover logic from before, I will fix it


const mutation = `mutation {
deleteProfilesWithExternalIds(
externalIds: ${formattedExternalIds},
externalProvider: "${EXTERNAL_PROVIDER}",
syncIds: ${formattedSyncIds}
syncIds: ${syncId}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the brackets are preserved when you convert an array to a string, if you want that

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They should be called like syncId: "28test", so I adjusted the format to that

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, but what is the purpose of the syncId variable still being an array?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I'll fix it as well

@illumin04 illumin04 merged commit 4907cbe into main Nov 18, 2024
5 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants