backend/src/models/responses/ResponseRunnerGroup.ts

56 lines
799 B
TypeScript

import {
IsInt,
IsNotEmpty,
IsObject,
IsOptional,
IsString
} from "class-validator";
import { GroupContact } from '../entities/GroupContact';
import { RunnerGroup } from '../entities/RunnerGroup';
/**
* Defines a track of given length.
*/
export abstract class ResponseRunnerGroup {
/**
* Autogenerated unique id (primary key).
*/
@IsInt()
@IsNotEmpty()
id: number;;
/**
* The groups's name.
*/
@IsString()
@IsNotEmpty()
name: string;
/**
* The group's contact.
* Optional.
*/
@IsObject()
@IsOptional()
contact?: GroupContact;
public constructor(group: RunnerGroup) {
this.id = group.id;
this.name = group.name;
this.contact = group.contact;
}
}