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

@@ -40,7 +40,9 @@ export class RunnerTeamController {
@OnUndefined(RunnerTeamNotFoundError)
@OpenAPI({ description: 'Returns a runnerTeam of a specified id (if it exists)' })
async getOne(@Param('id') id: number) {
return new ResponseRunnerTeam(await this.runnerTeamRepository.findOne({ id: id }, { relations: ['parentGroup', 'contact'] }));
let runnerTeam = await this.runnerTeamRepository.findOne({ id: id }, { relations: ['parentGroup', 'contact'] });
if (!runnerTeam) { throw new RunnerTeamNotFoundError(); }
return new ResponseRunnerTeam(runnerTeam);
}
@Post()