backend/src/models/responses/ResponseDonor.ts
Nicolai Ort bba35d189e
Some checks failed
continuous-integration/drone/pr Build is failing
Added donor donation amount to the donor response
ref #66
2021-01-13 17:32:10 +01:00

34 lines
795 B
TypeScript

import {
IsBoolean, IsInt
} from "class-validator";
import { Donor } from '../entities/Donor';
import { ResponseParticipant } from './ResponseParticipant';
/**
* Defines the donor response.
*/
export class ResponseDonor extends ResponseParticipant {
/**
* Does this donor need a receipt?
*/
@IsBoolean()
receiptNeeded: boolean;
/**
* Returns the total donations of a donor based on his linked donations.
*/
@IsInt()
donationAmount: number;
/**
* Creates a ResponseRunner object from a runner.
* @param runner The user the response shall be build for.
*/
public constructor(donor: Donor) {
super(donor);
this.receiptNeeded = donor.receiptNeeded;
this.donationAmount = donor.donationAmount;
}
}