import { IsInt, IsObject, IsString } from "class-validator"; import { RunnerGroup } from '../entities/RunnerGroup'; import { RunnerTeam } from '../entities/RunnerTeam'; /** * Defines the team stats response. * This differs from the normal team responce. */ export class ResponseStatsTeam { /** * The team's id. */ @IsInt() id: number; /** * The team's name. */ @IsString() name: string; /** * The teams's currently ran distance in meters. */ @IsInt() distance: number; /** * The teams's currently collected donations. */ @IsInt() donationAmount: number; /** * The teams's parent group. */ @IsObject() parent: RunnerGroup; /** * Creates a new team stats response from a team * @param team The team whoes response shall be generated - the following relations have to be resolved: runners, runners.scans, runners.distanceDonations, runners.scans.track */ public constructor(team: RunnerTeam) { this.name = team.name; this.id = team.id; this.parent = team.parentGroup; this.distance = team.distance; this.donationAmount = team.distanceDonationAmount; } }