Basic data enrichment (#3023)
* Add Enrich to frontend * Naive backend implementation * Add work email check * Rename Enrich to Quick Action * Refactor logic to a separate service * Refacto to separate IntelligenceService * Small fixes * Missing Break statement * Address PR comments * Create company interface * Improve edge case handling * Use httpService instead of Axios * Fix server tests
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { HttpModule } from '@nestjs/axios';
|
||||
|
||||
import { ApiRestController } from 'src/core/api-rest/api-rest.controller';
|
||||
import { ApiRestService } from 'src/core/api-rest/api-rest.service';
|
||||
@ -6,7 +7,7 @@ import { ApiRestQueryBuilderModule } from 'src/core/api-rest/api-rest-query-buil
|
||||
import { AuthModule } from 'src/core/auth/auth.module';
|
||||
|
||||
@Module({
|
||||
imports: [ApiRestQueryBuilderModule, AuthModule],
|
||||
imports: [ApiRestQueryBuilderModule, AuthModule, HttpModule],
|
||||
controllers: [ApiRestController],
|
||||
providers: [ApiRestService],
|
||||
})
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { HttpService } from '@nestjs/axios';
|
||||
|
||||
import { ApiRestService } from 'src/core/api-rest/api-rest.service';
|
||||
import { EnvironmentService } from 'src/integrations/environment/environment.service';
|
||||
@ -24,6 +25,10 @@ describe('ApiRestService', () => {
|
||||
provide: TokenService,
|
||||
useValue: {},
|
||||
},
|
||||
{
|
||||
provide: HttpService,
|
||||
useValue: {},
|
||||
},
|
||||
],
|
||||
}).compile();
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { HttpService } from '@nestjs/axios';
|
||||
|
||||
import axios from 'axios';
|
||||
import { Request } from 'express';
|
||||
|
||||
import { EnvironmentService } from 'src/integrations/environment/environment.service';
|
||||
@ -15,6 +15,7 @@ export class ApiRestService {
|
||||
private readonly tokenService: TokenService,
|
||||
private readonly environmentService: EnvironmentService,
|
||||
private readonly apiRestQueryBuilderFactory: ApiRestQueryBuilderFactory,
|
||||
private readonly httpService: HttpService,
|
||||
) {}
|
||||
|
||||
async callGraphql(
|
||||
@ -26,7 +27,7 @@ export class ApiRestService {
|
||||
`${request.protocol}://${request.get('host')}`;
|
||||
|
||||
try {
|
||||
return await axios.post(`${baseUrl}/graphql`, data, {
|
||||
return await this.httpService.axiosRef.post(`${baseUrl}/graphql`, data, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: request.headers.authorization,
|
||||
|
||||
Reference in New Issue
Block a user