parent
ba396e0eba
commit
ba3b5eeefc
|
@ -0,0 +1,38 @@
|
|||
import { IsArray, IsNotEmpty, IsString } from 'class-validator';
|
||||
import { RunnerOrganization } from '../entities/RunnerOrganization';
|
||||
import { ResponseObjectType } from '../enums/ResponseObjectType';
|
||||
import { IResponse } from './IResponse';
|
||||
import { ResponseSelfServiceTeam } from './ResponseSelfServiceTeam';
|
||||
|
||||
/**
|
||||
* Defines the runner selfservice organization response.
|
||||
* Why? B/C runner's are not allowed to view all information available to admin users.
|
||||
*/
|
||||
export class ResponseSelfServiceOrganisation implements IResponse {
|
||||
/**
|
||||
* The responseType.
|
||||
* This contains the type of class/entity this response contains.
|
||||
*/
|
||||
responseType: ResponseObjectType = ResponseObjectType.SELFSERVICEORGANIZATION;
|
||||
|
||||
/**
|
||||
* The org's name.
|
||||
*/
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The org's teams (just containing name and id).
|
||||
*/
|
||||
@IsArray()
|
||||
teams: ResponseSelfServiceTeam[];
|
||||
|
||||
public constructor(org: RunnerOrganization) {
|
||||
this.name = org.name;
|
||||
this.teams = new Array<ResponseSelfServiceTeam>();
|
||||
for (let team of org.teams) {
|
||||
this.teams.push(new ResponseSelfServiceTeam(team));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue