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

Create organization using website if not found #1510

Merged
merged 24 commits into from
Sep 22, 2023

Conversation

yeganathan18
Copy link
Member

@yeganathan18 yeganathan18 commented Sep 17, 2023

Changes proposed ✍️

What

🤖 Generated by Copilot at a1a1139

This pull request refactors the logic for querying and creating organizations by website domain across different layers of the application. It also adds a feature to automatically assign members to organizations based on their email domains. The main files affected are organizationRepository.ts, organization.repo.ts, batchCreateOrganizations.ts, memberService.ts, and organizationService.ts.

🤖 Generated by Copilot at a1a1139

Sing, O Muse, of the skillful refactorings and features
That the valiant developers wrought in the organizationService
How they made it find or create by domain, with swift and graceful queries
And how they linked the members to their rightful organizations

Why

How

🤖 Generated by Copilot at a1a1139

  • Simplify and standardize the domain normalization and comparison logic for finding and creating organizations by using the websiteNormalizer utility function from the @crowd/common package (link, link, link, link)
  • Rename the findByDomain method to findOrCreateByDomain in the organizationService and organizationRepository classes to reflect the new functionality of creating a new organization if none is found by the domain (link, link, link)
  • Update the calls to the organizationService method in the memberService classes to use the new findOrCreateByDomain method and assign members to existing or newly created organizations based on their email domains (link, link)
  • Add the fallback logic for creating a new organization with the domain as its name and website in the organizationRepository classes in the backend and data_sink_worker folders (link, link)
  • Remove the unnecessary variables for the different variations of the domain in the organizationRepository class in the data_sink_worker folder (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.

@yeganathan18 yeganathan18 added the Improvement Created by Linear-GitHub Sync label Sep 17, 2023
@yeganathan18
Copy link
Member Author

I'd suggest that we merge and execute the website normalizer migration scripts first, and then proceed with this. Since the current PR discards iLike operations and uses an exact domain match search, helps in improving performance.

@yeganathan18 yeganathan18 force-pushed the improvement/create-org-with-domain branch from 815b9dd to 2e4fe2f Compare September 18, 2023 17:32
Copy link
Collaborator

@epipav epipav left a comment

Choose a reason for hiding this comment

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

included 2 comments

@yeganathan18 yeganathan18 force-pushed the improvement/create-org-with-domain branch from 2558bd4 to 8c8334c Compare September 21, 2023 08:55
@yeganathan18 yeganathan18 force-pushed the improvement/create-org-with-domain branch from 8c8334c to 1e61ade Compare September 21, 2023 09:10
@yeganathan18 yeganathan18 force-pushed the improvement/create-org-with-domain branch from b209693 to 719f853 Compare September 22, 2023 08:11
@yeganathan18 yeganathan18 force-pushed the improvement/create-org-with-domain branch from 0a19e8a to 80ed023 Compare September 22, 2023 10:35
@yeganathan18 yeganathan18 merged commit ae65bf2 into main Sep 22, 2023
8 checks passed
@yeganathan18 yeganathan18 deleted the improvement/create-org-with-domain branch September 22, 2023 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Created by Linear-GitHub Sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants