Implemented the basic request classes feature/1-input_classes #2

Merged
niggl merged 9 commits from feature/1-input_classes into dev 2021-02-03 16:49:23 +00:00
Showing only changes of commit e29c17a29a - Show all commits

36
src/models/RunnerGroup.ts Normal file
View File

@ -0,0 +1,36 @@
import { IsInt, IsNotEmpty, IsObject, IsOptional, IsString } from "class-validator";
/**
* Defines the runner group class - a simplified version of the backend's ResponseRunnerTeam/-Organization
*/
export abstract class RunnerGroup {
/**
* The group's id.
*/
@IsInt()
@IsNotEmpty()
id: number;;
/**
* The group's name.
*/
@IsString()
@IsNotEmpty()
name: string;
/**
* The group's parent group.
* If it is set this implies that the object is a team.
*/
@IsObject()
@IsOptional()
parentGroup?: RunnerGroup
/**
* Returns the groups full name in the format: org.name/team.name (or just org).
*/
public get fullName(): string {
if (!this.parentGroup) { return this.name; }
return `${this.name}/${this.parentGroup.fullName}`;
}
}