Refactor code and remove commented out sections

This commit is contained in:
Judson Cairo 2024-02-07 15:16:37 -03:00
parent 32026d1fd4
commit 34c53d352a
6 changed files with 0 additions and 24 deletions

View File

@ -4,8 +4,6 @@ import path from 'path';
import { ConfigService, Language } from '../config/env.config'; import { ConfigService, Language } from '../config/env.config';
// export class i18n {
// constructor(private readonly configService: ConfigService) {
const languages = ['en', 'pt-BR']; const languages = ['en', 'pt-BR'];
const translationsPath = path.join(__dirname, 'translations'); const translationsPath = path.join(__dirname, 'translations');
const configService: ConfigService = new ConfigService(); const configService: ConfigService = new ConfigService();
@ -31,6 +29,4 @@ i18next.init({
escapeValue: false, escapeValue: false,
}, },
}); });
// }
// }
export default i18next; export default i18next;

View File

@ -21,7 +21,6 @@ const logger = new Logger('Validate');
export abstract class RouterBroker { export abstract class RouterBroker {
constructor() {} constructor() {}
public routerPath(path: string, param = true) { public routerPath(path: string, param = true) {
// const route = param ? '/:instanceName/' + path : '/' + path;
let route = '/' + path; let route = '/' + path;
param ? (route += '/:instanceName') : null; param ? (route += '/:instanceName') : null;
@ -56,10 +55,6 @@ export abstract class RouterBroker {
message = stack.replace('instance.', ''); message = stack.replace('instance.', '');
} }
return message; return message;
// return {
// property: property.replace('instance.', ''),
// message,
// };
}); });
logger.error(message); logger.error(message);
throw new BadRequestException(message); throw new BadRequestException(message);

View File

@ -1,7 +1,4 @@
// import { isURL } from 'class-validator';
import { Logger } from '../../config/logger.config'; import { Logger } from '../../config/logger.config';
// import { BadRequestException } from '../../exceptions';
import { InstanceDto } from '../dto/instance.dto'; import { InstanceDto } from '../dto/instance.dto';
import { SettingsDto } from '../dto/settings.dto'; import { SettingsDto } from '../dto/settings.dto';
import { SettingsService } from '../services/settings.service'; import { SettingsService } from '../services/settings.service';

View File

@ -5,7 +5,6 @@ import { chatwootSchema, instanceNameSchema } from '../../validate/validate.sche
import { RouterBroker } from '../abstract/abstract.router'; import { RouterBroker } from '../abstract/abstract.router';
import { ChatwootDto } from '../dto/chatwoot.dto'; import { ChatwootDto } from '../dto/chatwoot.dto';
import { InstanceDto } from '../dto/instance.dto'; import { InstanceDto } from '../dto/instance.dto';
// import { ChatwootService } from '../services/chatwoot.service';
import { chatwootController } from '../whatsapp.module'; import { chatwootController } from '../whatsapp.module';
import { HttpStatus } from './index.router'; import { HttpStatus } from './index.router';

View File

@ -5,7 +5,6 @@ import { instanceNameSchema, settingsSchema } from '../../validate/validate.sche
import { RouterBroker } from '../abstract/abstract.router'; import { RouterBroker } from '../abstract/abstract.router';
import { InstanceDto } from '../dto/instance.dto'; import { InstanceDto } from '../dto/instance.dto';
import { SettingsDto } from '../dto/settings.dto'; import { SettingsDto } from '../dto/settings.dto';
// import { SettingsService } from '../services/settings.service';
import { settingsController } from '../whatsapp.module'; import { settingsController } from '../whatsapp.module';
import { HttpStatus } from './index.router'; import { HttpStatus } from './index.router';

View File

@ -51,11 +51,6 @@ export class ChatwootService {
this.cache.set(cacheKey, provider); this.cache.set(cacheKey, provider);
return provider; return provider;
// try {
// } catch (error) {
// this.logger.error('provider not found');
// return null;
// }
} }
private async clientCw(instance: InstanceDto) { private async clientCw(instance: InstanceDto) {
@ -389,10 +384,6 @@ export class ChatwootService {
q: query, q: query,
}); });
} else { } else {
// contact = await client.contacts.filter({
// accountId: this.provider.account_id,
// payload: this.getFilterPayload(query),
// });
// hotfix for: https://github.com/EvolutionAPI/evolution-api/pull/382. waiting fix: https://github.com/figurolatam/chatwoot-sdk/pull/7 // hotfix for: https://github.com/EvolutionAPI/evolution-api/pull/382. waiting fix: https://github.com/figurolatam/chatwoot-sdk/pull/7
contact = await chatwootRequest(this.getClientCwConfig(), { contact = await chatwootRequest(this.getClientCwConfig(), {
method: 'POST', method: 'POST',
@ -1194,7 +1185,6 @@ export class ChatwootService {
if (state !== 'open') { if (state !== 'open') {
if (state === 'close') { if (state === 'close') {
this.logger.verbose('request cleaning up instance: ' + instance.instanceName); this.logger.verbose('request cleaning up instance: ' + instance.instanceName);
// await this.waMonitor.cleaningUp(instance.instanceName);
} }
this.logger.verbose('connect to whatsapp'); this.logger.verbose('connect to whatsapp');
const number = command.split(':')[1]; const number = command.split(':')[1];