55
src/models/responses/ResponseStatsTeam.ts
Normal file
55
src/models/responses/ResponseStatsTeam.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
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 ResponseRunner object from a runner.
|
||||
* @param runner The user the response shall be build for.
|
||||
*/
|
||||
public constructor(team: RunnerTeam) {
|
||||
this.name = team.name;
|
||||
this.id = team.id;
|
||||
this.parent = team.parentGroup;
|
||||
this.distance = team.distance;
|
||||
this.donationAmount = team.distanceDonationAmount;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user