55
src/models/responses/ResponseRunnerGroup.ts
Normal file
55
src/models/responses/ResponseRunnerGroup.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
26
src/models/responses/ResponseRunnerTeam.ts
Normal file
26
src/models/responses/ResponseRunnerTeam.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import {
|
||||
IsNotEmpty,
|
||||
IsObject
|
||||
} from "class-validator";
|
||||
import { RunnerOrganisation } from '../entities/RunnerOrganisation';
|
||||
import { RunnerTeam } from '../entities/RunnerTeam';
|
||||
import { ResponseRunnerGroup } from './ResponseRunnerGroup';
|
||||
|
||||
/**
|
||||
* Defines RunnerTeam's response class.
|
||||
*/
|
||||
export class ResponseRunnerTeam extends ResponseRunnerGroup {
|
||||
|
||||
/**
|
||||
* The team's parent group (organisation).
|
||||
* Optional.
|
||||
*/
|
||||
@IsObject()
|
||||
@IsNotEmpty()
|
||||
parentGroup: RunnerOrganisation;
|
||||
|
||||
public constructor(team: RunnerTeam) {
|
||||
super(team);
|
||||
this.parentGroup = team.parentGroup;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user