First part of the action comment refactoring

ref #39
Why did i volunteer for this? It's just a glorified sleeping aid 😴
This commit is contained in:
2020-12-21 16:08:10 +01:00
parent d20d738218
commit 1d0d79f3da
9 changed files with 123 additions and 32 deletions

View File

@@ -6,21 +6,29 @@ import { RunnerOrganisation } from '../entities/RunnerOrganisation';
import { RunnerTeam } from '../entities/RunnerTeam';
import { CreateRunnerGroup } from './CreateRunnerGroup';
/**
* This class is used to update a RunnerTeam entity (via put request).
*/
export class UpdateRunnerTeam extends CreateRunnerGroup {
/**
* The updated team's id.
* This shouldn't have changed but it is here in case anyone ever wants to enable id changes (whyever they would want to).
*/
@IsInt()
id: number;
/**
* The team's parent group (organisation).
* The updated team's parentGroup.
* Just has to contain the organisation's id - everything else won't be checked or changed.
*/
@IsObject()
@IsNotEmpty()
parentGroup: RunnerOrganisation;
/**
* Loads the updated teams's parentGroup based on it's id.
*/
public async getParent(): Promise<RunnerOrganisation> {
if (this.parentGroup === undefined || this.parentGroup === null) {
throw new RunnerTeamNeedsParentError();
@@ -35,7 +43,7 @@ export class UpdateRunnerTeam extends CreateRunnerGroup {
}
/**
* Creates a RunnerTeam entity from this.
* Updates a provided RunnerTeam entity based on this.
*/
public async updateRunnerTeam(team: RunnerTeam): Promise<RunnerTeam> {