Add Affinity CRM
Objects
Third party object Name -> Unified Object
- [x] Person -> Contact
- [x] Organization -> Company
- [x] Opportunity -> Deal
- [x] Note -> Note
- [x] User
closes #448
/claim #448
Summary by CodeRabbit
-
New Features
- Introduced the
AffinityServicefor managing company, contact, deal, note, and user data integration with the Affinity CRM system. - Added methods for adding and synchronizing companies, contacts, deals, notes, and users.
- Implemented data mapping capabilities through new mapper classes for companies, contacts, deals, and notes.
- Expanded the available CRM connectors to include Affinity.
- Introduced the
-
Enhancements
- Extended existing data types to include new
Affinityvariants for better integration with the Affinity service. - Added a new column
crm_affinityto theconnector_setstable for improved CRM integration capabilities.
- Extended existing data types to include new
-
Bug Fixes
- Improved error handling during API interactions for better reliability and traceability.
-
Documentation
- Updated type definitions and interfaces to enhance clarity and maintainability.
Qovery can create a Preview Environment for this PR. To trigger its creation, please post a comment with one of the following command.
| Command | Blueprint environment |
|---|---|
| /qovery preview 783d0240-ec38-4387-a9a9-8e225f1bd3e1 | dev |
| /qovery preview {all|UUID1,UUID2,...} | To preview multiple environments |
This comment has been generated from Qovery AI :robot:. Below, a word from its wisdom :
Don’t Sacrifice Readability, you are going to debug it in 6 months
⚠️ No Changeset found
Latest commit: 9cbd82316ae922818d58667c338421e235229f63
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
@mit-27 is attempting to deploy a commit to the Panora Team on Vercel.
A member of the Team first needs to authorize it.
Walkthrough
Walkthrough
The changes introduce a comprehensive integration with the Affinity CRM system, adding new services, mappers, and data types for managing contacts, deals, companies, notes, and users. This integration enhances the CRM's ability to interact with Affinity's API, allowing for the addition and synchronization of various entities while maintaining backward compatibility with existing functionalities.
Changes
| Files | Change Summary |
|---|---|
packages/api/src/@core/utils/types/original/original.crm.ts |
Added new input and output types prefixed with "Affinity" for contacts, deals, companies, engagements, notes, and users. |
packages/api/src/crm/company/company.module.ts, packages/api/src/crm/contact/contact.module.ts, packages/api/src/crm/deal/deal.module.ts, packages/api/src/crm/note/note.module.ts, packages/api/src/crm/user/user.module.ts |
Added AffinityService and related mappers to the list of providers and exports in respective module files. |
packages/api/scripts/init.sql, packages/api/scripts/seed.sql |
Introduced a new column crm_affinity to the connector_sets table and modified the seed script to accommodate this new column. |
packages/shared/src/connectors/enum.ts |
Added AFFINITY to the CrmConnectors enum to support integration with the Affinity platform. |
Assessment against linked issues
| Objective | Addressed | Explanation |
|---|---|---|
| Add integration with Affinity (CRM) (#448) | ✅ | |
| Manage contacts through Affinity API (#448) | ✅ | |
| Manage deals through Affinity API (#448) | ✅ | |
| Manage companies through Affinity API (#448) | ✅ | |
| Manage notes through Affinity API (#448) | ✅ |
Possibly related PRs
- #484: The changes in this PR involve adding new types and integrations related to the "Close" CRM, which includes modifications to the
original.crm.tsfile, similar to the main PR's focus on enhancing type definitions for "Affinity" entities in the same file. - #482: This PR includes changes to the
original.crm.tsfile, which may relate to the type definitions and structures being modified in the main PR, indicating a potential overlap in the type system enhancements for CRM integrations.
[!TIP]
OpenAI O1 model for chat
- We have deployed OpenAI's latest O1 model for chat.
- OpenAI claims that this model has superior reasoning capabilities than their GPT-4o model.
- Please share any feedback with us in the discussions post.
Recent review details
Configuration used: CodeRabbit UI Review profile: ASSERTIVE
Commits
Files that changed from the base of the PR and between 5a6090301dfb86467fcdd1c7afad6a7ee4fa33e6 and 9cbd82316ae922818d58667c338421e235229f63.
Files selected for processing (8)
- packages/api/scripts/init.sql (1 hunks)
- packages/api/scripts/seed.sql (1 hunks)
- packages/api/src/@core/utils/types/original/original.crm.ts (11 hunks)
- packages/api/src/crm/company/company.module.ts (3 hunks)
- packages/api/src/crm/contact/contact.module.ts (2 hunks)
- packages/api/src/crm/deal/deal.module.ts (2 hunks)
- packages/api/src/crm/note/note.module.ts (2 hunks)
- packages/shared/src/connectors/enum.ts (1 hunks)
Additional comments not posted (24)
packages/shared/src/connectors/enum.ts (1)
9-9: LGTM!The addition of the
AFFINITYentry to theCrmConnectorsenum is a valid and consistent change. It expands the set of available CRM connectors without affecting the functionality of other connectors. The naming convention and enum structure remain intact.packages/api/scripts/seed.sql (2)
5-8: LGTM!The changes to the
INSERT INTO connector_setsstatement are consistent with the addition of the newcrm_affinitycolumn. The values being inserted for the new column are set toTRUEfor all rows, which seems appropriate. The modified statement has no syntax errors or logical issues.
5-5: Verify the schema change.The addition of the
crm_affinitycolumn to theconnector_setstable is necessary to match the values being inserted. The column name suggests that it is related to the Affinity CRM integration, which aligns with the PR objectives.To ensure the schema change has been properly applied, please run the following script:
Verification successful
Schema change verified successfully.
The
crm_affinitycolumn has been properly added to theconnector_setstable. This change is reflected in both the table definition and the insert statement:
- The column is defined in
packages/api/scripts/init.sqlascrm_affinity boolean NULL,.- It's included in the
INSERT INTOstatement inpackages/api/scripts/seed.sql.The schema change has been implemented correctly and consistently across the SQL files.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the existence of the `crm_affinity` column in the `connector_sets` table. # Test: Check if the `crm_affinity` column exists in the `connector_sets` table. # Expect: The column should be present in the table schema. echo "SELECT column_name FROM information_schema.columns WHERE table_name='connector_sets' AND column_name='crm_affinity';" | psql <database_name>Length of output: 289
Script:
#!/bin/bash # Search for the connector_sets table definition in SQL files rg -t sql "CREATE TABLE.*connector_sets" -A 50 # Search for any ALTER TABLE statements that might have added the crm_affinity column rg -t sql "ALTER TABLE.*connector_sets.*ADD.*crm_affinity" # Search for INSERT statements into connector_sets that include crm_affinity rg -t sql "INSERT INTO connector_sets.*crm_affinity"Length of output: 3954
packages/api/src/crm/note/note.module.ts (2)
25-26: LGTM!The imports for
AffinityNoteMapperandAffinityServiceare correctly added, which is a necessary step for integrating with Affinity CRM.
54-55: LGTM!The
AffinityServiceandAffinityNoteMapperare correctly added to the providers array, making them available for dependency injection within theNoteModule. This is consistent with the imports and necessary for integrating with Affinity CRM.packages/api/src/crm/deal/deal.module.ts (2)
25-26: LGTM!The imports for
AffinityDealMapperandAffinityServiceare correctly placed and follow the existing import structure. They suggest a new integration with Affinity CRM is being added.
55-56: LGTM!Adding the
AffinityServiceandAffinityDealMapperto the list of providers is a necessary step for integrating the Affinity CRM functionality into the existing system. The providers are correctly added and follow the existing structure.packages/api/src/crm/company/company.module.ts (2)
25-26: LGTM!The imports for
AffinityCompanyMapperandAffinityServiceare correctly specified and follow the existing import pattern in the file. They are necessary for integrating the Affinity CRM functionality into the module.
56-57: Looks good!Adding
AffinityServiceandAffinityCompanyMapperto the list of providers in the module is necessary for making them available for dependency injection. The additions follow the existing pattern of providing services and mappers for other CRM platforms and are consistent with the import statements and the overall module structure.packages/api/src/crm/contact/contact.module.ts (2)
26-27: LGTM!The imports for
AffinityContactMapperandAffinityServiceare correctly specified and follow the existing import pattern in the file.
57-58: LGTM!The addition of
AffinityServiceandAffinityContactMapperto the providers array is consistent with the existing pattern in the module and indicates that theContactModuleis being extended to support integration with the Affinity CRM system.The
AffinityServiceis likely responsible for interacting with the Affinity API, while theAffinityContactMapperis likely responsible for mapping Affinity contact data to the internal contact data structure.packages/api/src/@core/utils/types/original/original.crm.ts (12)
2-6: LGTM!The imports for the new "Affinity" related types are correctly structured and follow the existing pattern. The imported types are used later in the file to expand the existing type unions.
173-179: Looks good!The addition of
AffinityCompanyInputandCloseContactInputtypes to theOriginalContactInputunion type is consistent with the overall pattern of the file. This change expands the union to accommodate new input types related to "Affinity" and "Close" CRM systems without introducing any type mismatches or conflicts.
185-191: Approved.The addition of
AffinityDealInputtype to theOriginalDealInputunion type is consistent with the overall pattern of the file. This change expands the union to accommodate new input type related to "Affinity" CRM system without introducing any type mismatches or conflicts.
Line range hint
197-203: Change looks good.The addition of
AffinityCompanyInputtype to theOriginalCompanyInputunion type is consistent with the overall pattern of the file. This change expands the union to accommodate new input type related to "Affinity" CRM system without introducing any type mismatches or conflicts.
Line range hint
215-222: Looks good to me.The addition of
AffinityNoteInputtype to theOriginalNoteInputunion type is consistent with the overall pattern of the file. This change expands the union to accommodate new input type related to "Affinity" CRM system without introducing any type mismatches or conflicts.
230-231: LGTM.The addition of
AttioTaskInputtype to theOriginalTaskInputunion type is consistent with the overall pattern of the file. This change expands the union to accommodate new input type related to "Attio" CRM system without introducing any type mismatches or conflicts.
244-249: Approved.The addition of
AffinityUserInputtype to theOriginalUserInputunion type is consistent with the overall pattern of the file. This change expands the union to accommodate new input type related to "Affinity" CRM system without introducing any type mismatches or conflicts.
Line range hint
264-270: Looks good.The addition of
AffinityContactInputtype to theOriginalContactOutputunion type is consistent with the overall pattern of the file. This change expands the union to accommodate new output type related to "Affinity" CRM system without introducing any type mismatches or conflicts.
Line range hint
274-280: Change looks good.The addition of
AffinityDealOutputtype to theOriginalDealOutputunion type is consistent with the overall pattern of the file. This change expands the union to accommodate new output type related to "Affinity" CRM system without introducing any type mismatches or conflicts.
Line range hint
284-290: LGTM.The addition of
AffinityCompanyOutputtype to theOriginalCompanyOutputunion type is consistent with the overall pattern of the file. This change expands the union to accommodate new output type related to "Affinity" CRM system without introducing any type mismatches or conflicts.
302-308: Approved.The addition of
AffinityNoteOutputtype to theOriginalNoteOutputunion type is consistent with the overall pattern of the file. This change expands the union to accommodate new output type related to "Affinity" CRM system without introducing any type mismatches or conflicts.
331-337: Looks good to me.The addition of
AffinityUserOutputtype to theOriginalUserOutputunion type is consistent with the overall pattern of the file. This change expands the union to accommodate new output type related to "Affinity" CRM system without introducing any type mismatches or conflicts.packages/api/scripts/init.sql (1)
559-559: LGTM!The new
crm_affinitycolumn is appropriately named and typed. AllowingNULLvalues provides flexibility.
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?
Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>.Generate unit testing code for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai generate interesting stats about this repository and render them as a table.@coderabbitai show all the console.log statements in this repository.@coderabbitai read src/utils.ts and generate unit testing code.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
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 using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaior@coderabbitai titleanywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
Hello @naelob and @rflihxyz, I cannot sign in to Affinity CRM (Every time I try to log in it always sends me a 'request to demo' link not the sign-in link ). Can I get credentials so I can test the connector?
⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.
Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.
Since your pull request originates from a forked repository, GitGuardian is not able to associate the secrets uncovered with secret incidents on your GitGuardian dashboard. Skipping this check run and merging your pull request will create secret incidents on your GitGuardian dashboard.
🔎 Detected hardcoded secret in your pull request
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 9198067 | Triggered | Generic Password | 5a6090301dfb86467fcdd1c7afad6a7ee4fa33e6 | .env.example | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.