Fix for getting one

ref #13
This commit is contained in:
2020-12-09 18:11:23 +01:00
parent e4cb8eba1d
commit 204e2352a9
4 changed files with 12 additions and 4 deletions

View File

@@ -39,7 +39,9 @@ export class RunnerController {
@OnUndefined(RunnerNotFoundError)
@OpenAPI({ description: 'Returns a runner of a specified id (if it exists)' })
async getOne(@Param('id') id: number) {
return new ResponseRunner(await this.runnerRepository.findOne({ id: id }, { relations: ['scans', 'group'] }));
let runner = await this.runnerRepository.findOne({ id: id }, { relations: ['scans', 'group'] })
if (!runner) { throw new RunnerNotFoundError(); }
return new ResponseRunner(runner);
}
@Post()