backend/src/models/responses/ResponseRunnerTeam.ts
Nicolai Ort ff7406e71a
All checks were successful
continuous-integration/drone/pr Build is passing
Cleaned up realations regarding response classes
ref #132
2021-01-30 16:19:42 +01:00

34 lines
1.1 KiB
TypeScript

import { IsNotEmpty, IsObject } from "class-validator";
import { RunnerTeam } from '../entities/RunnerTeam';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
import { ResponseRunnerGroup } from './ResponseRunnerGroup';
import { ResponseRunnerOrganization } from './ResponseRunnerOrganization';
/**
* Defines the runnerTeam response.
*/
export class ResponseRunnerTeam extends ResponseRunnerGroup implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.RUNNERTEAM;
/**
* The runnerTeam's parent group (organization).
*/
@IsObject()
@IsNotEmpty()
parentGroup: ResponseRunnerOrganization;
/**
* Creates a ResponseRunnerTeam object from a runnerTeam.
* @param team The team the response shall be build for.
*/
public constructor(team: RunnerTeam) {
super(team);
if (team.parentGroup) { this.parentGroup = team.parentGroup.toResponse(); }
}
}