Reverted simplification that created loops
All checks were successful
continuous-integration/drone/pr Build is passing
All checks were successful
continuous-integration/drone/pr Build is passing
ref #39
This commit is contained in:
parent
0ef6d9cc48
commit
7d5f3b092f
@ -75,19 +75,20 @@ export class ImportRunner {
|
|||||||
throw new RunnerGroupNeededError();
|
throw new RunnerGroupNeededError();
|
||||||
}
|
}
|
||||||
|
|
||||||
let group = await getConnectionManager().get().getRepository(RunnerGroup).findOne({ id: groupID });
|
let team = await getConnectionManager().get().getRepository(RunnerTeam).findOne({ id: groupID });
|
||||||
if (group instanceof RunnerTeam) { return group; }
|
if (team) { return team; }
|
||||||
if (!(group instanceof RunnerOrganisation) || !group) {
|
|
||||||
|
let org = await getConnectionManager().get().getRepository(RunnerOrganisation).findOne({ id: groupID });
|
||||||
|
if (!org) {
|
||||||
throw new RunnerOrganisationNotFoundError();
|
throw new RunnerOrganisationNotFoundError();
|
||||||
}
|
}
|
||||||
|
if (this.team === undefined) { return org; }
|
||||||
|
|
||||||
if (this.team === undefined) { return group; }
|
team = await getConnectionManager().get().getRepository(RunnerTeam).findOne({ name: this.team, parentGroup: org });
|
||||||
|
|
||||||
let team = await getConnectionManager().get().getRepository(RunnerTeam).findOne({ name: this.team, parentGroup: group });
|
|
||||||
if (!team) {
|
if (!team) {
|
||||||
let newRunnerTeam: RunnerTeam = new RunnerTeam();
|
let newRunnerTeam: RunnerTeam = new RunnerTeam();
|
||||||
newRunnerTeam.name = this.team;
|
newRunnerTeam.name = this.team;
|
||||||
newRunnerTeam.parentGroup = group;
|
newRunnerTeam.parentGroup = org;
|
||||||
team = await getConnectionManager().get().getRepository(RunnerTeam).save(newRunnerTeam);
|
team = await getConnectionManager().get().getRepository(RunnerTeam).save(newRunnerTeam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user