refactor(RunnerTeamController.remove): only load necessary relations

This commit is contained in:
Philipp Dormann 2025-03-28 12:00:55 +01:00
parent 4008a5ee72
commit c0d5af5d7a
Signed by: philipp
GPG Key ID: 3BB9ADD52DCA4314

View File

@ -119,7 +119,7 @@ export class RunnerTeamController {
async remove(@Param("id") id: number, @QueryParam("force") force: boolean) {
let team = await this.runnerTeamRepository.findOne({ id: id });
if (!team) { return null; }
let runnerTeam = await this.runnerTeamRepository.findOne(team, { relations: ['parentGroup', 'contact', 'runners'] });
let runnerTeam = await this.runnerTeamRepository.findOne(team, { relations: ['runners'] });
if (!force) {
if (runnerTeam.runners.length != 0) {