Switched selfservice donation.donor from string to object
continuous-integration/drone/pr Build is passing Details

ref #187
This commit is contained in:
Nicolai Ort 2021-04-03 17:07:44 +02:00
parent ca87774767
commit 0767943721
1 changed files with 3 additions and 4 deletions

View File

@ -2,6 +2,7 @@ import { IsInt, IsNotEmpty, IsPositive } from 'class-validator';
import { DistanceDonation } from '../entities/DistanceDonation';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
import { ResponseSelfServiceDonor } from './ResponseSelfServiceDonor';
/**
* Defines the runner selfservice donation response.
@ -18,7 +19,7 @@ export class ResponseSelfServiceDonation implements IResponse {
* The donation's donor.
*/
@IsNotEmpty()
donor: string;
donor: ResponseSelfServiceDonor;
/**
* The donation's amount in the smalles unit of your currency (default: euro cent).
@ -35,9 +36,7 @@ export class ResponseSelfServiceDonation implements IResponse {
amountPerDistance: number;
public constructor(donation: DistanceDonation) {
if (!donation.donor.middlename) { this.donor = donation.donor.firstname + " " + donation.donor.lastname; }
else { this.donor = donation.donor.firstname + " " + donation.donor.middlename + " " + donation.donor.lastname; }
this.donor = new ResponseSelfServiceDonor(donation.donor);
this.amountPerDistance = donation.amountPerDistance;
this.amount = donation.amount;
}