MCPcopy Create free account
hub / github.com/evolution-foundation/evolution-api / instanceLoggedGuard

Function instanceLoggedGuard

src/api/guards/instance.guard.ts:42–55  ·  view source on GitHub ↗
(req: Request, _: Response, next: NextFunction)

Source from the content-addressed store, hash-verified

40}
41
42export async function instanceLoggedGuard(req: Request, _: Response, next: NextFunction) {
43 if (req.originalUrl.includes('/instance/create')) {
44 const instance = req.body as InstanceDto;
45 if (await getInstance(instance.instanceName)) {
46 throw new ForbiddenException(`This name "${instance.instanceName}" is already in use.`);
47 }
48
49 if (waMonitor.waInstances[instance.instanceName]) {
50 delete waMonitor.waInstances[instance.instanceName];
51 }
52 }
53
54 next();
55}

Callers

nothing calls this directly

Calls 1

getInstanceFunction · 0.85

Tested by

no test coverage detected