backend/src/models/responses/ResponseRunnerGroup.ts

41 lines
894 B
TypeScript

import { IsInt, IsNotEmpty, IsObject, IsOptional, IsString } from "class-validator";
import { GroupContact } from '../entities/GroupContact';
import { RunnerGroup } from '../entities/RunnerGroup';
/**
* Defines the runnerGroup response.
*/
export abstract class ResponseRunnerGroup {
/**
* The runnerGroup's id.
*/
@IsInt()
@IsNotEmpty()
id: number;;
/**
* The runnerGroup's name.
*/
@IsString()
@IsNotEmpty()
name: string;
/**
* The runnerGroup's contact.
*/
@IsObject()
@IsOptional()
contact?: GroupContact;
/**
* Creates a ResponseRunnerGroup object from a runnerGroup.
* @param group The runnerGroup the response shall be build for.
*/
public constructor(group: RunnerGroup) {
this.id = group.id;
this.name = group.name;
this.contact = group.contact;
}
}