import { IsBoolean, IsInt } from "class-validator"; import { Donor } from '../entities/Donor'; import { ResponseObjectType } from '../enums/ResponseObjectType'; import { IResponse } from './IResponse'; import { ResponseParticipant } from './ResponseParticipant'; /** * Defines the donor response. */ export class ResponseDonor extends ResponseParticipant implements IResponse { /** * The responseType. * This contains the type of class/entity this response contains. */ responseType: ResponseObjectType = ResponseObjectType.DONOR; /** * 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; } }