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

Move services from messaging common module into the correct module and refactor them #6255

Closed
bosiraphael opened this issue Jul 15, 2024 · 1 comment · Fixed by #6409
Closed
Assignees

Comments

@bosiraphael
Copy link
Contributor

Scope & Context

All the services inside packages/twenty-server/src/modules/messaging/common/services were put there as a temporary solution to avoid circular dependencies.

Technical inputs

Move these services inside the correct module and refactor them to avoid circular dependencies.

Copy link
Contributor

greptile-apps bot commented Jul 15, 2024

Implementation Steps

  1. Move MessagingChannelSyncStatusService:

    • From: packages/twenty-server/src/modules/messaging/common/services/messaging-channel-sync-status.service.ts
    • To: packages/twenty-server/src/modules/messaging/services/messaging-channel-sync-status.service.ts
    • Update imports in dependent files.
  2. Move MessagingErrorHandlingService:

    • From: packages/twenty-server/src/modules/messaging/common/services/messaging-error-handling.service.ts
    • To: packages/twenty-server/src/modules/messaging/services/messaging-error-handling.service.ts
    • Update imports in dependent files.
  3. Move MessagingFetchByBatchesService:

    • From: packages/twenty-server/src/modules/messaging/common/services/messaging-fetch-by-batches.service.ts
    • To: packages/twenty-server/src/modules/messaging/services/messaging-fetch-by-batches.service.ts
    • Update imports in dependent files.
  4. Move MessagingMessageParticipantService:

    • From: packages/twenty-server/src/modules/messaging/common/services/messaging-message-participant.service.ts
    • To: packages/twenty-server/src/modules/messaging/repositories/message-participant/messaging-message-participant.service.ts
    • Update imports in dependent files.
  5. Move MessagingMessageThreadService:

    • From: packages/twenty-server/src/modules/messaging/common/services/messaging-message-thread.service.ts
    • To: packages/twenty-server/src/modules/messaging/repositories/message-thread/messaging-message-thread.service.ts
    • Update imports in dependent files.
  6. Move MessagingMessageService:

    • From: packages/twenty-server/src/modules/messaging/common/services/messaging-message.service.ts
    • To: packages/twenty-server/src/modules/messaging/repositories/message/messaging-message.service.ts
    • Update imports in dependent files.
  7. Move MessagingSaveMessagesAndEnqueueContactCreationService:

    • From: packages/twenty-server/src/modules/messaging/common/services/messaging-save-messages-and-enqueue-contact-creation.service.ts
    • To: packages/twenty-server/src/modules/messaging/services/messaging-save-messages-and-enqueue-contact-creation.service.ts
    • Update imports in dependent files.
  8. Move MessagingTelemetryService:

    • From: packages/twenty-server/src/modules/messaging/common/services/messaging-telemetry.service.ts
    • To: packages/twenty-server/src/modules/messaging/services/messaging-telemetry.service.ts
    • Update imports in dependent files.

Refactor to Avoid Circular Dependencies

  • Ensure that each service only imports what it needs.
  • Use dependency injection to pass instances where necessary.
  • Consider breaking down large services into smaller, more focused services if needed.

References

/packages/twenty-server/src/modules/messaging/common/services
/packages/twenty-server/src/modules/messaging/services
/packages/twenty-server/src/modules/messaging/repositories/message
/packages/twenty-server/src/modules/messaging/repositories/message-thread
/packages/twenty-server/src/modules/messaging/repositories/message-channel
/packages/twenty-server/src/modules/messaging/message-cleaner/services

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 · Edit Issue Bot Settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
1 participant