Implemented the second round of the toResponse normalisationf for all classes
ref #67
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { IsInt, IsNotEmpty } from "class-validator";
|
||||
import { ChildEntity, ManyToOne, OneToMany } from "typeorm";
|
||||
import { ResponseRunner } from '../responses/ResponseRunner';
|
||||
import { DistanceDonation } from "./DistanceDonation";
|
||||
import { Participant } from "./Participant";
|
||||
import { RunnerCard } from "./RunnerCard";
|
||||
@@ -66,4 +67,11 @@ export class Runner extends Participant {
|
||||
public get distanceDonationAmount(): number {
|
||||
return this.distanceDonations.reduce((sum, current) => sum + current.amountPerDistance, 0) * this.distance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns this entity into it's response class.
|
||||
*/
|
||||
public toResponse(): ResponseRunner {
|
||||
return new ResponseRunner(this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user