twentyhq / twenty

Building a modern alternative to Salesforce, powered by the community.
https://twenty.com
GNU Affero General Public License v3.0
15.59k stars 1.65k forks source link

Refactor messaging module to remove all provider specific code and put it inside the drivers folders #6256

Closed bosiraphael closed 1 day ago

bosiraphael commented 1 month ago

Scope & Context

Generalize the code inside the messaging module and put all provider specific code inside the drivers folders.

Technical inputs

Refactor messaging services to remove all provider specific code and put it inside the drivers folders.

greptile-apps[bot] commented 1 month ago

Refactor Steps

  1. Move Gmail Client Provider:

    • Move MessagingGmailClientProvider from /packages/twenty-server/src/modules/messaging/message-import-manager/drivers/gmail/providers/messaging-gmail-client.provider.ts to /packages/twenty-server/src/modules/messaging/message-import-manager/drivers/gmail/providers/gmail-client.provider.ts.
  2. Update Imports in Messaging Module:

    • Update the imports in /packages/twenty-server/src/workspace/messaging/services/providers/messaging-providers.module.ts to reflect the new location of the Gmail client provider.
      import { GmailClientProvider } from 'src/modules/messaging/message-import-manager/drivers/gmail/providers/gmail-client.provider';
  3. Refactor Services:

    • Move any provider-specific services from /packages/twenty-server/src/workspace/messaging/services to the respective driver folders under /packages/twenty-server/src/modules/messaging/message-import-manager/drivers.
    • For example, move gmail-full-sync.service.ts and gmail-partial-sync.service.ts to /packages/twenty-server/src/modules/messaging/message-import-manager/drivers/gmail/services/.
  4. Generalize Messaging Module:

    • Ensure that /packages/twenty-server/src/workspace/messaging/messaging.module.ts does not contain any provider-specific logic. It should only import generalized services and modules.
  5. Update Service Imports:

    • Update the imports in any files that were using the moved services to reflect their new locations.
      import { GmailFullSyncService } from 'src/modules/messaging/message-import-manager/drivers/gmail/services/gmail-full-sync.service';
  6. Test and Validate:

    • Ensure that all references to the moved files are updated and that the application functions correctly after the refactor.

References

/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/gmail/providers/messaging-gmail-client.provider.ts /packages/twenty-server/src/workspace/messaging/services/providers/messaging-providers.module.ts /packages/twenty-server/src/modules/messaging/message-import-manager/drivers /packages/twenty-server/src/modules/messaging/message-import-manager /packages/twenty-server/src/modules/messaging /packages/twenty-server/src/workspace/messaging

#### About Greptile This response provides a starting point for your research, not a precise solution. Help us improve! Please leave a ๐Ÿ‘ if this is helpful and ๐Ÿ‘Ž if it is irrelevant. [Ask Greptile](https://app.greptile.com/chat/github/twentyhq/twenty/main) ยท [Edit Issue Bot Settings](https://app.greptile.com/apps/github)