process external scans and check room exists
This commit is contained in:
parent
83ab0c4ea7
commit
70d03553d7
5 changed files with 149 additions and 1 deletions
|
@ -9,6 +9,9 @@ import SettingHelper from "../helpers/settingsHelper";
|
|||
import sharp from "sharp";
|
||||
import ico from "sharp-ico";
|
||||
import { FileSystemHelper } from "../helpers/fileSystemHelper";
|
||||
import { SocketConnectionTypes } from "../enums/socketEnum";
|
||||
import SocketServer from "../websocket";
|
||||
import BadRequestException from "../exceptions/badRequestException";
|
||||
|
||||
/**
|
||||
* @description get all calendar items by types or nscdr
|
||||
|
@ -54,6 +57,26 @@ export async function getCalendarItemsByTypes(req: Request, res: Response): Prom
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get all calendar items by types or nscdr
|
||||
* @summary passphrase is passed as value pair like `type:passphrase`
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function checkScannerRoomExists(req: Request, res: Response): Promise<any> {
|
||||
let roomId = req.body.roomId;
|
||||
|
||||
const socketsInOtherRoom = await SocketServer.server.of(SocketConnectionTypes.scanner).in(roomId).fetchSockets();
|
||||
const count = socketsInOtherRoom.length;
|
||||
|
||||
if (count != 0) {
|
||||
res.sendStatus(204);
|
||||
} else {
|
||||
throw new BadRequestException("room does not exists");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get configuration of UI
|
||||
* @param req {Request} Express req object
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue