From ba396e0eba15647b3004437a5a9949c7a69e828d Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Wed, 24 Feb 2021 18:18:10 +0100 Subject: [PATCH] Added selfservice team response model ref #146 --- .../responses/ResponseSelfServiceTeam.ts | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/models/responses/ResponseSelfServiceTeam.ts diff --git a/src/models/responses/ResponseSelfServiceTeam.ts b/src/models/responses/ResponseSelfServiceTeam.ts new file mode 100644 index 0000000..3e43343 --- /dev/null +++ b/src/models/responses/ResponseSelfServiceTeam.ts @@ -0,0 +1,36 @@ +import { IsInt, IsNotEmpty, IsPositive, IsString } from 'class-validator'; +import { RunnerTeam } from '../entities/RunnerTeam'; +import { ResponseObjectType } from '../enums/ResponseObjectType'; +import { IResponse } from './IResponse'; + +/** + * Defines the runner selfservice team response. + * Why? B/C runner's are not allowed to view all information available to admin users. +*/ +export class ResponseSelfServiceTeam implements IResponse { + /** + * The responseType. + * This contains the type of class/entity this response contains. + */ + responseType: ResponseObjectType = ResponseObjectType.SELFSERVICETEAM; + + /** + * The team's name. + */ + @IsNotEmpty() + @IsString() + name: string; + + /** + * The team's id. + * Will be used to insert runners it into that team. + */ + @IsInt() + @IsPositive() + id: number; + + public constructor(team: RunnerTeam) { + this.name = team.name; + this.id = team.id; + } +} \ No newline at end of file