Skip to content

Commit

Permalink
feat: updated providers
Browse files Browse the repository at this point in the history
  • Loading branch information
naelob committed Oct 29, 2023
1 parent 40e5a72 commit 5c5435e
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 4 deletions.
14 changes: 13 additions & 1 deletion api/src/crm/contact/contact.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,21 @@ import { ContactService } from './services/contact.service';
import { ContactController } from './contact.controller';
import { PrismaService } from 'src/prisma/prisma.service';
import { FreshSalesService } from './services/freshsales';
import { ZendeskService } from './services/zendesk';
import { ZohoService } from './services/zoho';
import { PipedriveService } from './services/pipedrive';
import { HubspotService } from './services/hubspot';

@Module({
controllers: [ContactController],
providers: [ContactService, PrismaService, FreshSalesService],
providers: [
ContactService,
PrismaService,
FreshSalesService,
ZendeskService,
ZohoService,
PipedriveService,
HubspotService,
],
})
export class ContactModule {}
31 changes: 28 additions & 3 deletions api/src/crm/contact/services/contact.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,48 @@ import { Injectable } from '@nestjs/common';
import { CreateContactDto } from '../dto/create-contact.dto';
import { PrismaService } from 'src/prisma/prisma.service';
import { FreshSalesService } from './freshsales';
import { HubspotService } from './hubspot';
import { ZohoService } from './zoho';
import { ZendeskService } from './zendesk';
import { PipedriveService } from './pipedrive';

@Injectable()
export class ContactService {
constructor(
private prisma: PrismaService,
public freshSales: FreshSalesService,
public freshsales: FreshSalesService,
public hubspot: HubspotService,
public zoho: ZohoService,
public zendesk: ZendeskService,
public pipedrive: PipedriveService,
) {}

async addContact(createContactDto: CreateContactDto, integrationId: string) {

Check warning on line 21 in api/src/crm/contact/services/contact.service.ts

View workflow job for this annotation

GitHub Actions / build-api (16.x)

'createContactDto' is defined but never used

Check warning on line 21 in api/src/crm/contact/services/contact.service.ts

View workflow job for this annotation

GitHub Actions / build-api (16.x)

'integrationId' is defined but never used
//TODO: call addToDbBackup()
//TODO: add createContact info body to DB => addToDbBackup()
//TODO: get the destination provider => call destinationCRMInDb()
const dest = {};
let resp;
switch (dest) {
case 'freshsales':
resp = await this.freshSales.addContact();
resp = await this.freshsales.addContact();
break;

case 'zoho':
resp = await this.zoho.addContact();
break;

case 'zendesk':
resp = await this.zendesk.addContact();
break;

case 'hubspot':
resp = await this.hubspot.addContact();
break;

case 'pipedrive':
resp = await this.pipedrive.addContact();
break;

default:
break;
}
Expand Down
8 changes: 8 additions & 0 deletions api/src/crm/contact/services/hubspot/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Injectable } from '@nestjs/common';

@Injectable()
export class HubspotService {
async addContact() {
return;
}
}
8 changes: 8 additions & 0 deletions api/src/crm/contact/services/pipedrive/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Injectable } from '@nestjs/common';

@Injectable()
export class PipedriveService {
async addContact() {
return;
}
}
8 changes: 8 additions & 0 deletions api/src/crm/contact/services/zendesk/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Injectable } from '@nestjs/common';

@Injectable()
export class ZendeskService {
async addContact() {
return;
}
}
8 changes: 8 additions & 0 deletions api/src/crm/contact/services/zoho/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Injectable } from '@nestjs/common';

@Injectable()
export class ZohoService {
async addContact() {
return;
}
}

0 comments on commit 5c5435e

Please sign in to comment.