First feature version 0.1.0 #102

Merged
niggl merged 39 commits from dev into main 2021-01-15 19:31:43 +00:00
Showing only changes of commit 09ad081b37 - Show all commits

View File

@ -1,7 +1,6 @@
import { IsInt, IsPositive } from 'class-validator'; import { IsInt, IsPositive } from 'class-validator';
import { getConnectionManager } from 'typeorm'; import { getConnectionManager } from 'typeorm';
import { RunnerGroupNotFoundError } from '../../../errors/RunnerGroupErrors'; import { RunnerGroupNotFoundError } from '../../../errors/RunnerGroupErrors';
import { RunnerOrganisationWrongTypeError } from '../../../errors/RunnerOrganisationErrors';
import { RunnerTeamNeedsParentError } from '../../../errors/RunnerTeamErrors'; import { RunnerTeamNeedsParentError } from '../../../errors/RunnerTeamErrors';
import { Runner } from '../../entities/Runner'; import { Runner } from '../../entities/Runner';
import { RunnerGroup } from '../../entities/RunnerGroup'; import { RunnerGroup } from '../../entities/RunnerGroup';
@ -48,12 +47,8 @@ export class UpdateRunner extends CreateParticipant {
if (this.group === undefined || this.group === null) { if (this.group === undefined || this.group === null) {
throw new RunnerTeamNeedsParentError(); throw new RunnerTeamNeedsParentError();
} }
if (!isNaN(this.group.id)) { let group = await getConnectionManager().get().getRepository(RunnerGroup).findOne({ id: this.group });
let group = await getConnectionManager().get().getRepository(RunnerGroup).findOne({ id: this.group.id });
if (!group) { throw new RunnerGroupNotFoundError; } if (!group) { throw new RunnerGroupNotFoundError; }
return group; return group;
} }
throw new RunnerOrganisationWrongTypeError;
}
} }