@@ -1,5 +1,6 @@
 | 
			
		||||
import { IsInt, IsNotEmpty, IsPositive } from "class-validator";
 | 
			
		||||
import { Donation } from '../entities/Donation';
 | 
			
		||||
import { DonationStatus } from '../enums/DonationStatus';
 | 
			
		||||
import { ResponseObjectType } from '../enums/ResponseObjectType';
 | 
			
		||||
import { IResponse } from './IResponse';
 | 
			
		||||
import { ResponseDonor } from './ResponseDonor';
 | 
			
		||||
@@ -15,6 +16,12 @@ export class ResponseDonation implements IResponse {
 | 
			
		||||
    */
 | 
			
		||||
    responseType: ResponseObjectType = ResponseObjectType.DONATION;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
    * The donation's payment status.
 | 
			
		||||
    * Provides you with a quick indicator of it's payment status.
 | 
			
		||||
    */
 | 
			
		||||
    status: DonationStatus;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The donation's id.
 | 
			
		||||
     */
 | 
			
		||||
@@ -49,5 +56,11 @@ export class ResponseDonation implements IResponse {
 | 
			
		||||
        this.donor = donation.donor.toResponse();
 | 
			
		||||
        this.amount = donation.amount;
 | 
			
		||||
        this.payedAmount = donation.payedAmount;
 | 
			
		||||
        if (this.payedAmount < this.amount) {
 | 
			
		||||
            this.status = DonationStatus.OPEN;
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            this.status = DonationStatus.PAYED;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user