Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 1x 1x 1x 1x 6x 6x 1x 9x 4x 5x 4x 1x 1x | import { Controller, HttpException, Logger, Post, Req } from '@nestjs/common'; import { Request } from 'express'; import { isCommand } from './command.interface'; import { TesteeService } from '../testee/testee.service'; @Controller() export class CommandController { constructor( private readonly testeeService: TesteeService ) {} private readonly logger = new Logger(CommandController.name); @Post('/command') postCommand(@Req() request: Request): void { if ((typeof request.body.command === 'undefined') || !isCommand(request.body.command)) { throw new HttpException('invalid command data', 400); } if ((typeof request.body.testIds === 'undefined') || !Array.isArray(request.body.testIds)) { throw new HttpException('no testIds given', 400); } this.logger.log('/command', request.body); this.testeeService.broadcastCommandToTestees(request.body.command, request.body.testIds); } } |