36
									
								
								src/models/RunnerGroup.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								src/models/RunnerGroup.ts
									
									
									
									
									
										Normal 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}`;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user