All checks were successful
		
		
	
	continuous-integration/drone/pr Build is passing
				
			ref #193
		
			
				
	
	
		
			28 lines
		
	
	
		
			853 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			853 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { IsInt, IsPositive } from 'class-validator';
 | |
| import { FixedDonation } from '../../entities/FixedDonation';
 | |
| import { UpdateDonation } from './UpdateDonation';
 | |
| 
 | |
| /**
 | |
|  * This class is used to update a FixedDonation entity (via put request).
 | |
|  */
 | |
| export class UpdateFixedDonation extends UpdateDonation {
 | |
|     /**
 | |
|      * The updated donation's amount.
 | |
|      * The unit is your currency's smallest unit (default: euro cent).
 | |
|      */
 | |
|     @IsInt()
 | |
|     @IsPositive()
 | |
|     amount: number;
 | |
| 
 | |
|     /**
 | |
|      * Update a FixedDonation entity based on this.
 | |
|      * @param donation The donation that shall be updated.
 | |
|      */
 | |
|     public async update(donation: FixedDonation): Promise<FixedDonation> {
 | |
|         donation.amount = this.amount;
 | |
|         donation.paidAmount = this.paidAmount;
 | |
|         donation.donor = await this.getDonor();
 | |
| 
 | |
|         return donation;
 | |
|     }
 | |
| } |