Merge branch 'dev' of https://git.odit.services/lfk/backend into dev
This commit is contained in:
commit
09f4998499
@ -39,7 +39,9 @@ export class RunnerController {
|
|||||||
@OnUndefined(RunnerNotFoundError)
|
@OnUndefined(RunnerNotFoundError)
|
||||||
@OpenAPI({ description: 'Returns a runner of a specified id (if it exists)' })
|
@OpenAPI({ description: 'Returns a runner of a specified id (if it exists)' })
|
||||||
async getOne(@Param('id') id: number) {
|
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()
|
@Post()
|
||||||
|
@ -41,7 +41,9 @@ export class RunnerOrganisationController {
|
|||||||
@OnUndefined(RunnerOrganisationNotFoundError)
|
@OnUndefined(RunnerOrganisationNotFoundError)
|
||||||
@OpenAPI({ description: 'Returns a runnerOrganisation of a specified id (if it exists)' })
|
@OpenAPI({ description: 'Returns a runnerOrganisation of a specified id (if it exists)' })
|
||||||
async getOne(@Param('id') id: number) {
|
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()
|
@Post()
|
||||||
|
@ -40,7 +40,9 @@ export class RunnerTeamController {
|
|||||||
@OnUndefined(RunnerTeamNotFoundError)
|
@OnUndefined(RunnerTeamNotFoundError)
|
||||||
@OpenAPI({ description: 'Returns a runnerTeam of a specified id (if it exists)' })
|
@OpenAPI({ description: 'Returns a runnerTeam of a specified id (if it exists)' })
|
||||||
async getOne(@Param('id') id: number) {
|
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()
|
@Post()
|
||||||
|
@ -37,7 +37,9 @@ export class TrackController {
|
|||||||
@OnUndefined(TrackNotFoundError)
|
@OnUndefined(TrackNotFoundError)
|
||||||
@OpenAPI({ description: "Returns a track of a specified id (if it exists)" })
|
@OpenAPI({ description: "Returns a track of a specified id (if it exists)" })
|
||||||
async getOne(@Param('id') id: number) {
|
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()
|
@Post()
|
||||||
|
@ -35,7 +35,12 @@ export class CreateRunnerTeam extends CreateRunnerGroup {
|
|||||||
let newRunnerTeam: RunnerTeam = new RunnerTeam();
|
let newRunnerTeam: RunnerTeam = new RunnerTeam();
|
||||||
|
|
||||||
newRunnerTeam.name = this.name;
|
newRunnerTeam.name = this.name;
|
||||||
|
try {
|
||||||
newRunnerTeam.parentGroup = await this.getParent();
|
newRunnerTeam.parentGroup = await this.getParent();
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
newRunnerTeam.contact = await this.getContact()
|
newRunnerTeam.contact = await this.getContact()
|
||||||
|
|
||||||
return newRunnerTeam;
|
return newRunnerTeam;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user