| @@ -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() | ||||
|   | ||||
| @@ -41,7 +41,9 @@ export class RunnerOrganisationController { | ||||
| 	@OnUndefined(RunnerOrganisationNotFoundError) | ||||
| 	@OpenAPI({ description: 'Returns a runnerOrganisation of a specified id (if it exists)' }) | ||||
| 	async getOne(@Param('id') id: number) { | ||||
| 		return new ResponseRunnerOrganisation(await this.runnerOrganisationRepository.findOne({ id: id }, { relations: ['address', 'contact', 'teams'] })); | ||||
| 		let runnerOrg = await this.runnerOrganisationRepository.findOne({ id: id }, { relations: ['address', 'contact', 'teams'] }); | ||||
| 		if (!runnerOrg) { throw new RunnerOrganisationNotFoundError(); } | ||||
| 		return new ResponseRunnerOrganisation(runnerOrg); | ||||
| 	} | ||||
|  | ||||
| 	@Post() | ||||
|   | ||||
| @@ -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() | ||||
|   | ||||
| @@ -37,7 +37,9 @@ export class TrackController { | ||||
| 	@OnUndefined(TrackNotFoundError) | ||||
| 	@OpenAPI({ description: "Returns a track of a specified id (if it exists)" }) | ||||
| 	async getOne(@Param('id') id: number) { | ||||
| 		return new ResponseTrack(await this.trackRepository.findOne({ id: id })); | ||||
| 		let track = await this.trackRepository.findOne({ id: id }); | ||||
| 		if (!track) { throw new TrackNotFoundError(); } | ||||
| 		return new ResponseTrack(track); | ||||
| 	} | ||||
|  | ||||
| 	@Post() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user