parent
45675b0699
commit
179add80f4
@ -84,6 +84,7 @@ export class RunnerController {
|
||||
@ResponseSchema(RunnerNotFoundError, { statusCode: 404 })
|
||||
@OpenAPI({ description: 'Delete a specified runner (if it exists).' })
|
||||
async remove(@EntityFromParam('id') runner: Runner, @QueryParam("force") force: boolean) {
|
||||
if (!runner) { throw new RunnerNotFoundError(); }
|
||||
const responseRunner = await this.runnerRepository.findOne(runner, { relations: ['scans', 'group'] });
|
||||
|
||||
if (!runner) {
|
||||
|
@ -89,12 +89,9 @@ export class RunnerOrganisationController {
|
||||
@ResponseSchema(RunnerOrganisationHasRunnersError, { statusCode: 406 })
|
||||
@OpenAPI({ description: 'Delete a specified runnerOrganisation (if it exists).' })
|
||||
async remove(@EntityFromParam('id') organisation: RunnerOrganisation, @QueryParam("force") force: boolean) {
|
||||
if (!organisation) { throw new RunnerOrganisationNotFoundError() }
|
||||
let runnerOrganisation = await this.runnerOrganisationRepository.findOne(organisation, { relations: ['address', 'contact', 'runners', 'teams'] });
|
||||
|
||||
if (!runnerOrganisation) {
|
||||
throw new RunnerOrganisationNotFoundError();
|
||||
}
|
||||
|
||||
if (!force) {
|
||||
if (runnerOrganisation.teams.length != 0) {
|
||||
throw new RunnerOrganisationHasTeamsError();
|
||||
|
@ -88,12 +88,9 @@ export class RunnerTeamController {
|
||||
@ResponseSchema(RunnerTeamHasRunnersError, { statusCode: 406 })
|
||||
@OpenAPI({ description: 'Delete a specified runnerTeam (if it exists).' })
|
||||
async remove(@EntityFromParam('id') team: RunnerTeam, @QueryParam("force") force: boolean) {
|
||||
if (!team) { throw new RunnerTeamNotFoundError(); }
|
||||
let runnerTeam = await this.runnerTeamRepository.findOne(team, { relations: ['parentGroup', 'contact', 'runners'] });
|
||||
|
||||
if (!runnerTeam) {
|
||||
throw new RunnerTeamNotFoundError();
|
||||
}
|
||||
|
||||
if (!force) {
|
||||
if (runnerTeam.runners.length != 0) {
|
||||
throw new RunnerTeamHasRunnersError();
|
||||
|
Loading…
x
Reference in New Issue
Block a user