feat(donors): Resolve donations with donors via pagination
This commit is contained in:
parent
b9fe9f1c24
commit
12a9ae2493
|
@ -53,7 +53,9 @@ export class ResponseDonation implements IResponse {
|
|||
*/
|
||||
public constructor(donation: Donation) {
|
||||
this.id = donation.id;
|
||||
this.donor = donation.donor.toResponse();
|
||||
if (donation.donor) {
|
||||
this.donor = donation.donor.toResponse();
|
||||
}
|
||||
this.amount = donation.amount;
|
||||
this.paidAmount = donation.paidAmount || 0;
|
||||
if (this.paidAmount < this.amount) {
|
||||
|
|
|
@ -4,6 +4,7 @@ import {
|
|||
import { Donor } from '../entities/Donor';
|
||||
import { ResponseObjectType } from '../enums/ResponseObjectType';
|
||||
import { IResponse } from './IResponse';
|
||||
import { ResponseDonation } from './ResponseDonation';
|
||||
import { ResponseParticipant } from './ResponseParticipant';
|
||||
|
||||
/**
|
||||
|
@ -34,6 +35,8 @@ export class ResponseDonor extends ResponseParticipant implements IResponse {
|
|||
@IsInt()
|
||||
paidDonationAmount: number;
|
||||
|
||||
donations: Array<ResponseDonation>;
|
||||
|
||||
/**
|
||||
* Creates a ResponseRunner object from a runner.
|
||||
* @param runner The user the response shall be build for.
|
||||
|
@ -43,5 +46,11 @@ export class ResponseDonor extends ResponseParticipant implements IResponse {
|
|||
this.receiptNeeded = donor.receiptNeeded;
|
||||
this.donationAmount = donor.donationAmount;
|
||||
this.paidDonationAmount = donor.paidDonationAmount;
|
||||
this.donations = new Array<ResponseDonation>();
|
||||
if (donor.donations?.length > 0) {
|
||||
for (const donation of donor.donations) {
|
||||
this.donations.push(donation.toResponse())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue