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

Organization identities and merging #1458

Merged
merged 30 commits into from
Sep 12, 2023
Merged

Organization identities and merging #1458

merged 30 commits into from
Sep 12, 2023

Conversation

epipav
Copy link
Collaborator

@epipav epipav commented Sep 11, 2023

Changes proposed ✍️

What

🤖 Generated by Copilot at a9a53ae

This pull request implements a new feature to allow merging organizations with multiple identities from different platforms, and updates the backend and frontend services, models, repositories, and components to support the new organization schema and logic. It also adds and modifies some SQL migration files, helper functions, types, and routes related to the organization feature.

🤖 Generated by Copilot at a9a53ae

We are the masters of identity
We merge the organizations with our code
We create or update with agility
We drop the tables that explode

Why

How

🤖 Generated by Copilot at a9a53ae

  • Add a new route and function for the organization merge endpoint, which allows merging two organizations into one by validating the user permissions, calling the merge function from the organization service, and sending back the payload and status using the response handler. (link, link)
  • Catches any errors and rolls back the transaction if needed. (link)
  • Returns the record as the payload. (link, link, link, link, link, link)
  • Modify the organization service to add a check for the identities before updating an existing organization, using the checkIdentities function from the organization repository. This is to handle any conflicts or duplicates with the identities, and also to throw an error if any strong identities sent already exist in another organization, as this function is mainly used for manual updates through the UI and does not perform an auto-merge or make strong identities weak. (link)
  • Modify the organization service to use the createOrUpdate function instead of the findOrCreate function in the createFromEmail function, as the createOrUpdate function handles the organization identities better and allows creating or updating organizations with multiple identities from different platforms. (link)
  • Modify the organization enrichment service to use the identities array instead of the name field to filter and update the organizations, as the organization table no longer has a name column and uses the identities array instead. It also adds a logic to get the platform to use for enrichment based on the identity platforms and the enrichment platform priority, and get the identity for enrichment based on the platform. It also adds a logic to check and move the identities between organizations before updating them, using the checkIdentities and addIdentity functions from the organization repository. This is to handle any conflicts or duplicates with the identities, and also to add any new identities from the data to the record. It also adds a logic to check and add any new identities from the enrichment data to the identities array, based on the platform and the handle fields. This is to ensure that the organization identities are updated with the enrichment data. It also adds a try-catch block to handle the transaction and the unique field error. (link, link, link, link, link, link, link, link, link)

Checklist ✅

  • Label appropriately with Feature, Improvement, or Bug.
  • Add screehshots to the PR description for relevant FE changes
  • New backend functionality has been unit-tested.
  • API documentation has been updated (if necessary) (see docs on API documentation).
  • Quality standards are met.

@epipav epipav added the Feature Created by Linear-GitHub Sync label Sep 11, 2023
@epipav epipav marked this pull request as ready for review September 11, 2023 14:58
@epipav epipav merged commit fd98789 into main Sep 12, 2023
8 of 10 checks passed
@epipav epipav deleted the feature/organizations-merge branch September 12, 2023 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Created by Linear-GitHub Sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants