(req: Request, _: Response, next: NextFunction)
| 40 | } |
| 41 | |
| 42 | export 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 | } |
nothing calls this directly
no test coverage detected