feat: Now you can register several typebots with triggers

This commit is contained in:
Davidson Gomes
2024-06-08 19:04:57 -03:00
parent 56df0caab0
commit fe9803b828
19 changed files with 1023 additions and 282 deletions

View File

@@ -1,9 +1,6 @@
import { NextFunction, Request, Response } from 'express';
import { existsSync } from 'fs';
import { join } from 'path';
import { CacheConf, configService, Database } from '../../config/env.config';
import { INSTANCE_DIR } from '../../config/path.config';
import {
BadRequestException,
ForbiddenException,
@@ -33,7 +30,7 @@ async function getInstance(instanceName: string) {
return exists || (await prisma.instance.findMany({ where: { name: instanceName } })).length > 0;
}
return exists || existsSync(join(INSTANCE_DIR, instanceName));
return false;
} catch (error) {
throw new InternalServerErrorException(error?.toString());
}
@@ -65,6 +62,7 @@ export async function instanceLoggedGuard(req: Request, _: Response, next: NextF
if (waMonitor.waInstances[instance.instanceName]) {
waMonitor.waInstances[instance.instanceName]?.removeRabbitmqQueues();
waMonitor.waInstances[instance.instanceName]?.removeSqsQueues();
delete waMonitor.waInstances[instance.instanceName];
}
}