From 24de82f6dff1ff07cab5b5a851519a290b642266 Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Sun, 20 Dec 2020 17:25:41 +0100 Subject: [PATCH] Moved runner teams to the new put mechanism ref #39 --- src/controllers/RunnerTeamController.ts | 2 +- src/models/actions/UpdateRunnerTeam.ts | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/controllers/RunnerTeamController.ts b/src/controllers/RunnerTeamController.ts index e02098a..5040e8c 100644 --- a/src/controllers/RunnerTeamController.ts +++ b/src/controllers/RunnerTeamController.ts @@ -82,7 +82,7 @@ export class RunnerTeamController { throw new RunnerTeamIdsNotMatchingError(); } - await this.runnerTeamRepository.update(oldRunnerTeam, await runnerTeam.toRunnerTeam()); + await this.runnerTeamRepository.save(await runnerTeam.updateRunnerTeam(oldRunnerTeam)); return new ResponseRunnerTeam(await this.runnerTeamRepository.findOne({ id: runnerTeam.id }, { relations: ['parentGroup', 'contact'] })); } diff --git a/src/models/actions/UpdateRunnerTeam.ts b/src/models/actions/UpdateRunnerTeam.ts index 0028cf8..8eaee39 100644 --- a/src/models/actions/UpdateRunnerTeam.ts +++ b/src/models/actions/UpdateRunnerTeam.ts @@ -37,14 +37,12 @@ export class UpdateRunnerTeam extends CreateRunnerGroup { /** * Creates a RunnerTeam entity from this. */ - public async toRunnerTeam(): Promise { - let newRunnerTeam: RunnerTeam = new RunnerTeam(); + public async updateRunnerTeam(team: RunnerTeam): Promise { - newRunnerTeam.id = this.id; - newRunnerTeam.name = this.name; - newRunnerTeam.parentGroup = await this.getParent(); - newRunnerTeam.contact = await this.getContact() + team.name = this.name; + team.parentGroup = await this.getParent(); + team.contact = await this.getContact() - return newRunnerTeam; + return team; } } \ No newline at end of file