Switched selfservice donation.donor from string to object
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
ref #187
This commit is contained in:
parent
ca87774767
commit
0767943721
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue