mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-24 22:27:46 -06:00
Squashed commit of the following:
commitfb6e58b3c4Merge:1d3d55767e9845Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Wed Jul 26 09:39:37 2023 -0300 Merge branch 'release/1.4.5' commit67e98456bbAuthor: Davidson Gomes <davidsongviolao@gmail.com> Date: Wed Jul 26 09:39:27 2023 -0300 fix: Fix mids going duplicated in chatwoot commit3e47420534Merge:3f419741d3d557Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Wed Jul 26 09:38:44 2023 -0300 Merge tag '1.4.5' into develop * Fixed problems in localization template in chatwoot * Fix mids going duplicated in chatwoot commit1d3d557c43Merge:6b926dc3f41974Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Wed Jul 26 09:38:36 2023 -0300 Merge branch 'release/1.4.5' commit3f41974a75Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Wed Jul 26 09:38:22 2023 -0300 fix: Fix mids going duplicated in chatwoot commit3e3c7397a5Merge:de0c9a1dcb5170Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Wed Jul 26 09:36:10 2023 -0300 Merge branch 'develop' of github.com:EvolutionAPI/evolution-api into develop commitdcb51702e7Merge:4769d75dd0c1e2Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Wed Jul 26 09:36:01 2023 -0300 Merge pull request #30 from codephix/patch-1 Update whatsapp.service.ts commitde0c9a1effAuthor: Davidson Gomes <davidsongviolao@gmail.com> Date: Wed Jul 26 09:34:10 2023 -0300 fix: fixed problems in localization template commitdd0c1e20a7Author: CodePhix <contato@codephix.com> Date: Tue Jul 25 19:59:42 2023 -0300 Update whatsapp.service.ts commit4769d75dc3Merge:ecae0776b926dcAuthor: Davidson Gomes <davidsongviolao@gmail.com> Date: Tue Jul 25 16:20:04 2023 -0300 Merge tag '1.4.4' into develop * Fixed chatwoot line wrap issue * Solved receive location in chatwoot * When requesting the pairing code, it also brings the qr code * Option reopen_conversation in chatwoot endpoint * Option conversation_pending in chatwoot endpoint commit6b926dc697Merge:2b6dbfdecae077Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Tue Jul 25 16:19:54 2023 -0300 Merge branch 'release/1.4.4' commitecae077c6dAuthor: Davidson Gomes <davidsongviolao@gmail.com> Date: Tue Jul 25 16:16:49 2023 -0300 fix: Option conversation_pending in chatwoot endpoint commit78ab1bed35Merge:6bb1abd2b6dbfdAuthor: Davidson Gomes <davidsongviolao@gmail.com> Date: Tue Jul 25 15:31:16 2023 -0300 Merge tag '1.4.4' into develop * Fixed chatwoot line wrap issue * Solved receive location in chatwoot * When requesting the pairing code, it also brings the qr code * Option reopen_conversation in chatwoot endpoint * Option conversation_pending in chatwoot endpoint commit2b6dbfde6bMerge:82b15676bb1abdAuthor: Davidson Gomes <davidsongviolao@gmail.com> Date: Tue Jul 25 15:31:06 2023 -0300 Merge branch 'release/1.4.4' commit6bb1abd7f0Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Tue Jul 25 15:29:42 2023 -0300 fix: Option conversation_pending in chatwoot endpoint commitaef92240ccAuthor: Davidson Gomes <davidsongviolao@gmail.com> Date: Tue Jul 25 15:20:21 2023 -0300 fix: Option conversation_pending in chatwoot endpoint commitf0d8c2d095Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Tue Jul 25 13:19:15 2023 -0300 fix: Solved receive location in chatwoot commit14529f2c35Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Tue Jul 25 12:47:35 2023 -0300 fix: When requesting the pairing code, it also brings the qr code commit89f40d54d9Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Tue Jul 25 12:41:54 2023 -0300 fix: Solved receive location in chatwoot commit4c006970a2Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Tue Jul 25 11:52:26 2023 -0300 fix: Fixed chatwoot line wrap issue commitde676041dfMerge:1cd729182b1567Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Tue Jul 25 10:51:53 2023 -0300 Merge tag '1.4.3' into develop * Adjusts in settings with options always_online, read_messages and read_status * Fixed send webhook for event CALL * Create instance with settings commit82b1567ae5Merge:f95f3121cd7291Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Tue Jul 25 10:51:42 2023 -0300 Merge branch 'release/1.4.3' commit1cd7291068Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Tue Jul 25 10:51:28 2023 -0300 version: 1.4.3 commitfdee1df5b3Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Tue Jul 25 10:42:45 2023 -0300 fix: Create instance with settings commitc314d00ccdAuthor: Davidson Gomes <davidsongviolao@gmail.com> Date: Tue Jul 25 10:42:34 2023 -0300 fix: Create instance with settings commit62e2a8a6e3Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Tue Jul 25 10:23:18 2023 -0300 fix: Fixed send webhook for event CALL commita12231a0aaAuthor: Davidson Gomes <davidsongviolao@gmail.com> Date: Tue Jul 25 09:57:28 2023 -0300 fix: Adjusts in settings with options always_online, read_messages and read_status commit183efd427aMerge:4d9ca4bf95f312Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Mon Jul 24 20:52:58 2023 -0300 Merge tag '1.4.2' into develop * Fixed validation is set settings * Adjusts in group validations * Ajusts in sticker message to chatwoot commitf95f3126c3Merge:cc91f2e4d9ca4bAuthor: Davidson Gomes <davidsongviolao@gmail.com> Date: Mon Jul 24 20:52:46 2023 -0300 Merge branch 'release/1.4.2' commit4d9ca4b451Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Mon Jul 24 20:52:34 2023 -0300 version: 1.4.2 commitc76334a68aAuthor: Davidson Gomes <davidsongviolao@gmail.com> Date: Mon Jul 24 20:32:29 2023 -0300 fix: Ajusts in sticker message to chatwoot commitf475391ba6Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Mon Jul 24 20:32:15 2023 -0300 fix: Ajusts in sticker message to chatwoot commitb77f22790bAuthor: Davidson Gomes <davidsongviolao@gmail.com> Date: Mon Jul 24 20:13:18 2023 -0300 fix: Fixed validation is set settings commit757a578c6eMerge:c582476f8e1892Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Mon Jul 24 20:12:51 2023 -0300 Merge branch 'develop' of github.com:EvolutionAPI/evolution-api into develop commitc5824767c8Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Mon Jul 24 20:11:49 2023 -0300 fix: Fixed validation is set settings commit84f3f07279Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Mon Jul 24 20:11:15 2023 -0300 fix: Fixed validation is set settings commitf8e1892eeeMerge:036a8ed58ed6f3Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Mon Jul 24 20:08:24 2023 -0300 fix: group validation Group validation commit036a8edca0Merge:3d8e6f4ef4be6aAuthor: Davidson Gomes <davidsongviolao@gmail.com> Date: Mon Jul 24 20:07:05 2023 -0300 fix: Promote All Participants in Create Group Promote All Participants in Create Group commit58ed6f395fAuthor: Alan Mosko <moskoweb@gmail.com> Date: Mon Jul 24 19:59:09 2023 -0300 Validação de Grupo commitef4be6a612Author: Alan Mosko <moskoweb@gmail.com> Date: Mon Jul 24 19:53:03 2023 -0300 Start commit3d8e6f4394Merge:8b6e5770cc1f18Author: Davidson Gomes <davidsongviolao@gmail.com> Date: Mon Jul 24 19:08:39 2023 -0300 fix: Fixed mentions Fixed mentions commit0cc1f18a7eAuthor: Alan Mosko <moskoweb@gmail.com> Date: Mon Jul 24 19:05:32 2023 -0300 [BUG] Correção de mencionar Caso seja enviado everyOne como false sem passar nada no mentioned commit8b6e577b8fMerge:f9abd90cc91f2eAuthor: Davidson Gomes <davidsongviolao@gmail.com> Date: Mon Jul 24 18:28:57 2023 -0300 Merge tag '1.4.1' into develop * Fixed reconnect with pairing code or qrcode * Fixed problem in createJid
This commit is contained in:
@@ -1,112 +1,121 @@
|
||||
import fs from 'fs';
|
||||
import { MongoClient } from 'mongodb';
|
||||
import { join } from 'path';
|
||||
|
||||
import { Auth, ConfigService, Database } from '../../config/env.config';
|
||||
import { Logger } from '../../config/logger.config';
|
||||
import { AuthRepository } from './auth.repository';
|
||||
import { ChatRepository } from './chat.repository';
|
||||
import { ChatwootRepository } from './chatwoot.repository';
|
||||
import { ContactRepository } from './contact.repository';
|
||||
import { MessageRepository } from './message.repository';
|
||||
import { ChatRepository } from './chat.repository';
|
||||
import { ContactRepository } from './contact.repository';
|
||||
import { MessageUpRepository } from './messageUp.repository';
|
||||
import { SettingsRepository } from './settings.repository';
|
||||
import { MongoClient } from 'mongodb';
|
||||
import { WebhookRepository } from './webhook.repository';
|
||||
import { ChatwootRepository } from './chatwoot.repository';
|
||||
import { SettingsRepository } from './settings.repository';
|
||||
|
||||
import { AuthRepository } from './auth.repository';
|
||||
import { Auth, ConfigService, Database } from '../../config/env.config';
|
||||
import { join } from 'path';
|
||||
import fs from 'fs';
|
||||
import { Logger } from '../../config/logger.config';
|
||||
export class RepositoryBroker {
|
||||
constructor(
|
||||
public readonly message: MessageRepository,
|
||||
public readonly chat: ChatRepository,
|
||||
public readonly contact: ContactRepository,
|
||||
public readonly messageUpdate: MessageUpRepository,
|
||||
public readonly webhook: WebhookRepository,
|
||||
public readonly chatwoot: ChatwootRepository,
|
||||
public readonly settings: SettingsRepository,
|
||||
public readonly auth: AuthRepository,
|
||||
private configService: ConfigService,
|
||||
dbServer?: MongoClient,
|
||||
) {
|
||||
this.dbClient = dbServer;
|
||||
this.__init_repo_without_db__();
|
||||
}
|
||||
constructor(
|
||||
public readonly message: MessageRepository,
|
||||
public readonly chat: ChatRepository,
|
||||
public readonly contact: ContactRepository,
|
||||
public readonly messageUpdate: MessageUpRepository,
|
||||
public readonly webhook: WebhookRepository,
|
||||
public readonly chatwoot: ChatwootRepository,
|
||||
public readonly settings: SettingsRepository,
|
||||
public readonly auth: AuthRepository,
|
||||
private configService: ConfigService,
|
||||
dbServer?: MongoClient,
|
||||
) {
|
||||
this.dbClient = dbServer;
|
||||
this.__init_repo_without_db__();
|
||||
}
|
||||
|
||||
private dbClient?: MongoClient;
|
||||
private readonly logger = new Logger('RepositoryBroker');
|
||||
private dbClient?: MongoClient;
|
||||
private readonly logger = new Logger('RepositoryBroker');
|
||||
|
||||
public get dbServer() {
|
||||
return this.dbClient;
|
||||
}
|
||||
public get dbServer() {
|
||||
return this.dbClient;
|
||||
}
|
||||
|
||||
private __init_repo_without_db__() {
|
||||
this.logger.verbose('initializing repository without db');
|
||||
if (!this.configService.get<Database>('DATABASE').ENABLED) {
|
||||
const storePath = join(process.cwd(), 'store');
|
||||
private __init_repo_without_db__() {
|
||||
this.logger.verbose('initializing repository without db');
|
||||
if (!this.configService.get<Database>('DATABASE').ENABLED) {
|
||||
const storePath = join(process.cwd(), 'store');
|
||||
|
||||
this.logger.verbose('creating store path: ' + storePath);
|
||||
try {
|
||||
const authDir = join(storePath, 'auth', this.configService.get<Auth>('AUTHENTICATION').TYPE);
|
||||
const chatsDir = join(storePath, 'chats');
|
||||
const contactsDir = join(storePath, 'contacts');
|
||||
const messagesDir = join(storePath, 'messages');
|
||||
const messageUpDir = join(storePath, 'message-up');
|
||||
const webhookDir = join(storePath, 'webhook');
|
||||
const chatwootDir = join(storePath, 'chatwoot');
|
||||
const settingsDir = join(storePath, 'settings');
|
||||
const tempDir = join(storePath, 'temp');
|
||||
this.logger.verbose('creating store path: ' + storePath);
|
||||
try {
|
||||
const authDir = join(
|
||||
storePath,
|
||||
'auth',
|
||||
this.configService.get<Auth>('AUTHENTICATION').TYPE,
|
||||
);
|
||||
const chatsDir = join(storePath, 'chats');
|
||||
const contactsDir = join(storePath, 'contacts');
|
||||
const messagesDir = join(storePath, 'messages');
|
||||
const messageUpDir = join(storePath, 'message-up');
|
||||
const webhookDir = join(storePath, 'webhook');
|
||||
const chatwootDir = join(storePath, 'chatwoot');
|
||||
const settingsDir = join(storePath, 'settings');
|
||||
const tempDir = join(storePath, 'temp');
|
||||
|
||||
if (!fs.existsSync(authDir)) {
|
||||
this.logger.verbose('creating auth dir: ' + authDir);
|
||||
fs.mkdirSync(authDir, { recursive: true });
|
||||
}
|
||||
if (!fs.existsSync(chatsDir)) {
|
||||
this.logger.verbose('creating chats dir: ' + chatsDir);
|
||||
fs.mkdirSync(chatsDir, { recursive: true });
|
||||
}
|
||||
if (!fs.existsSync(contactsDir)) {
|
||||
this.logger.verbose('creating contacts dir: ' + contactsDir);
|
||||
fs.mkdirSync(contactsDir, { recursive: true });
|
||||
}
|
||||
if (!fs.existsSync(messagesDir)) {
|
||||
this.logger.verbose('creating messages dir: ' + messagesDir);
|
||||
fs.mkdirSync(messagesDir, { recursive: true });
|
||||
}
|
||||
if (!fs.existsSync(messageUpDir)) {
|
||||
this.logger.verbose('creating message-up dir: ' + messageUpDir);
|
||||
fs.mkdirSync(messageUpDir, { recursive: true });
|
||||
}
|
||||
if (!fs.existsSync(webhookDir)) {
|
||||
this.logger.verbose('creating webhook dir: ' + webhookDir);
|
||||
fs.mkdirSync(webhookDir, { recursive: true });
|
||||
}
|
||||
if (!fs.existsSync(chatwootDir)) {
|
||||
this.logger.verbose('creating chatwoot dir: ' + chatwootDir);
|
||||
fs.mkdirSync(chatwootDir, { recursive: true });
|
||||
}
|
||||
if (!fs.existsSync(settingsDir)) {
|
||||
this.logger.verbose('creating settings dir: ' + settingsDir);
|
||||
fs.mkdirSync(settingsDir, { recursive: true });
|
||||
}
|
||||
if (!fs.existsSync(tempDir)) {
|
||||
this.logger.verbose('creating temp dir: ' + tempDir);
|
||||
fs.mkdirSync(tempDir, { recursive: true });
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error(error);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
const storePath = join(process.cwd(), 'store');
|
||||
|
||||
this.logger.verbose('creating store path: ' + storePath);
|
||||
|
||||
const tempDir = join(storePath, 'temp');
|
||||
|
||||
if (!fs.existsSync(tempDir)) {
|
||||
this.logger.verbose('creating temp dir: ' + tempDir);
|
||||
fs.mkdirSync(tempDir, { recursive: true });
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error(error);
|
||||
}
|
||||
if (!fs.existsSync(authDir)) {
|
||||
this.logger.verbose('creating auth dir: ' + authDir);
|
||||
fs.mkdirSync(authDir, { recursive: true });
|
||||
}
|
||||
if (!fs.existsSync(chatsDir)) {
|
||||
this.logger.verbose('creating chats dir: ' + chatsDir);
|
||||
fs.mkdirSync(chatsDir, { recursive: true });
|
||||
}
|
||||
if (!fs.existsSync(contactsDir)) {
|
||||
this.logger.verbose('creating contacts dir: ' + contactsDir);
|
||||
fs.mkdirSync(contactsDir, { recursive: true });
|
||||
}
|
||||
if (!fs.existsSync(messagesDir)) {
|
||||
this.logger.verbose('creating messages dir: ' + messagesDir);
|
||||
fs.mkdirSync(messagesDir, { recursive: true });
|
||||
}
|
||||
if (!fs.existsSync(messageUpDir)) {
|
||||
this.logger.verbose('creating message-up dir: ' + messageUpDir);
|
||||
fs.mkdirSync(messageUpDir, { recursive: true });
|
||||
}
|
||||
if (!fs.existsSync(webhookDir)) {
|
||||
this.logger.verbose('creating webhook dir: ' + webhookDir);
|
||||
fs.mkdirSync(webhookDir, { recursive: true });
|
||||
}
|
||||
if (!fs.existsSync(chatwootDir)) {
|
||||
this.logger.verbose('creating chatwoot dir: ' + chatwootDir);
|
||||
fs.mkdirSync(chatwootDir, { recursive: true });
|
||||
}
|
||||
if (!fs.existsSync(settingsDir)) {
|
||||
this.logger.verbose('creating settings dir: ' + settingsDir);
|
||||
fs.mkdirSync(settingsDir, { recursive: true });
|
||||
}
|
||||
if (!fs.existsSync(tempDir)) {
|
||||
this.logger.verbose('creating temp dir: ' + tempDir);
|
||||
fs.mkdirSync(tempDir, { recursive: true });
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error(error);
|
||||
}
|
||||
} else {
|
||||
const storePath = join(process.cwd(), 'store');
|
||||
|
||||
this.logger.verbose('creating store path: ' + storePath);
|
||||
|
||||
const tempDir = join(storePath, 'temp');
|
||||
const chatwootDir = join(storePath, 'chatwoot');
|
||||
|
||||
if (!fs.existsSync(chatwootDir)) {
|
||||
this.logger.verbose('creating chatwoot dir: ' + chatwootDir);
|
||||
fs.mkdirSync(chatwootDir, { recursive: true });
|
||||
}
|
||||
if (!fs.existsSync(tempDir)) {
|
||||
this.logger.verbose('creating temp dir: ' + tempDir);
|
||||
fs.mkdirSync(tempDir, { recursive: true });
|
||||
}
|
||||
try {
|
||||
} catch (error) {
|
||||
this.logger.error(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user