From e00977b2b2f19713fee4bbdfcfc02aeefa68afe2 Mon Sep 17 00:00:00 2001 From: nael Date: Fri, 29 Dec 2023 23:28:32 +0100 Subject: [PATCH] :memo: Updated INTEGRATIONS.md --- INTEGRATIONS.md | 50 +++++-------------- .../api/src/crm/contact/contact.module.ts | 2 +- .../ticketing/attachment/attachment.module.ts | 2 +- .../src/ticketing/comment/comment.module.ts | 2 +- .../src/ticketing/contact/contact.module.ts | 1 + .../api/src/ticketing/ticket/ticket.module.ts | 2 +- .../api/src/ticketing/user/user.module.ts | 2 +- 7 files changed, 19 insertions(+), 42 deletions(-) diff --git a/INTEGRATIONS.md b/INTEGRATIONS.md index 44ae184ad..8f1ad6ffa 100644 --- a/INTEGRATIONS.md +++ b/INTEGRATIONS.md @@ -154,7 +154,7 @@ export interface IContactService { ): Promise>; syncContacts( - linkedUserId: string, + linkedUserId: string, ): Promise>; } ``` @@ -166,10 +166,13 @@ export class My3rdPartyService implements IContactService { private prisma: PrismaService, private logger: LoggerService, private cryptoService: EncryptionService, + private registry: ServiceRegistry, ) { this.logger.setContext( CrmObject.contact.toUpperCase() + ':' + My3rdPartyService.name, ); + this.registry.registerService('my3rdPartyService', this); + } async addContact( contactData: 3rdPartyContactInput, @@ -286,35 +289,7 @@ export const contactUnificationMapping = { }; ``` -Don't forget to add your service you've defined at step 1 inside the Registry under `/crm/contact/services/registry.service.ts`. - -```ts -@Injectable() -export class ServiceRegistry { - private serviceMap: Map; - - constructor( - freshsales: FreshSalesService, - hubspot: HubspotService, - zoho: ZohoService, - zendesk: ZendeskService, - pipedrive: PipedriveService, - // ADD YOUR 3RD PARTY HERE - my3rdParty: My3rdPartyService - ) { - this.serviceMap = new Map(); - this.serviceMap.set('freshsales', freshsales); - this.serviceMap.set('hubspot', hubspot); - this.serviceMap.set('zoho', zoho); - this.serviceMap.set('zendesk', zendesk); - this.serviceMap.set('pipedrive', pipedrive); - // ADD YOUR 3RD PARTY HERE - this.serviceMap.set('my3rdParty', my3rdParty); - } -} -``` - -Finally, add it under the `ContactModule` module ! +Don't forget to add your service you've defined at step 1 inside the module under `/crm/contact/contact.module.ts`. ```ts @Module({ @@ -327,21 +302,22 @@ Finally, add it under the `ContactModule` module ! providers: [ ContactService, PrismaService, - FreshSalesService, - ZendeskService, - ZohoService, - PipedriveService, - HubspotService, LoggerService, FieldMappingService, - SyncContactsService, + SyncService, WebhookService, EncryptionService, ServiceRegistry, + /* PROVIDERS SERVICES */ + FreshSalesService, + ZendeskService, + ZohoService, + PipedriveService, + HubspotService, //INSERT YOUR SERVICE HERE My3rdPartyService ], - exports: [SyncContactsService], + exports: [SyncService], }) export class ContactModule {} diff --git a/packages/api/src/crm/contact/contact.module.ts b/packages/api/src/crm/contact/contact.module.ts index d19ca0fb8..40ddaa9fb 100644 --- a/packages/api/src/crm/contact/contact.module.ts +++ b/packages/api/src/crm/contact/contact.module.ts @@ -31,7 +31,7 @@ import { ServiceRegistry } from './services/registry.service'; WebhookService, EncryptionService, ServiceRegistry, - //PROVIDERS SERVICES + /* PROVIDERS SERVICES */ FreshsalesService, ZendeskService, ZohoService, diff --git a/packages/api/src/ticketing/attachment/attachment.module.ts b/packages/api/src/ticketing/attachment/attachment.module.ts index e2e13f301..5cdf80a80 100644 --- a/packages/api/src/ticketing/attachment/attachment.module.ts +++ b/packages/api/src/ticketing/attachment/attachment.module.ts @@ -27,7 +27,7 @@ import { BullModule } from '@nestjs/bull'; EncryptionService, FieldMappingService, ServiceRegistry, - //PROVIDERS SERVICES + /* PROVIDERS SERVICES */ ZendeskService, ], exports: [SyncService], diff --git a/packages/api/src/ticketing/comment/comment.module.ts b/packages/api/src/ticketing/comment/comment.module.ts index bca9f5764..0e9f8e6c7 100644 --- a/packages/api/src/ticketing/comment/comment.module.ts +++ b/packages/api/src/ticketing/comment/comment.module.ts @@ -27,7 +27,7 @@ import { ServiceRegistry } from './services/registry.service'; EncryptionService, FieldMappingService, ServiceRegistry, - //PROVIDERS SERVICES + /* PROVIDERS SERVICES */ ZendeskService, ], exports: [SyncService], diff --git a/packages/api/src/ticketing/contact/contact.module.ts b/packages/api/src/ticketing/contact/contact.module.ts index 5a79d9543..cba0c9133 100644 --- a/packages/api/src/ticketing/contact/contact.module.ts +++ b/packages/api/src/ticketing/contact/contact.module.ts @@ -27,6 +27,7 @@ import { ContactController } from './contact.controller'; EncryptionService, FieldMappingService, ServiceRegistry, + /* PROVIDERS SERVICES */ ZendeskService, ], exports: [SyncService], diff --git a/packages/api/src/ticketing/ticket/ticket.module.ts b/packages/api/src/ticketing/ticket/ticket.module.ts index 3ee4cac93..9fd39e2f2 100644 --- a/packages/api/src/ticketing/ticket/ticket.module.ts +++ b/packages/api/src/ticketing/ticket/ticket.module.ts @@ -27,7 +27,7 @@ import { ServiceRegistry } from './services/registry.service'; EncryptionService, FieldMappingService, ServiceRegistry, - //PROVIDERS SERVICES + /* PROVIDERS SERVICES */ ZendeskService, ], exports: [SyncService], diff --git a/packages/api/src/ticketing/user/user.module.ts b/packages/api/src/ticketing/user/user.module.ts index d8634acfa..9b1fd29ed 100644 --- a/packages/api/src/ticketing/user/user.module.ts +++ b/packages/api/src/ticketing/user/user.module.ts @@ -27,7 +27,7 @@ import { SyncService } from './sync/sync.service'; EncryptionService, FieldMappingService, ServiceRegistry, - //PROVIDERS SERVICES + /* PROVIDERS SERVICES */ ZendeskService, ], exports: [SyncService],