| @@ -29,7 +29,7 @@ export class CreateDonor extends CreateParticipant { | ||||
|         newDonor.address = await this.getAddress(); | ||||
|         newDonor.receiptNeeded = this.receiptNeeded; | ||||
|  | ||||
|         if (this.receiptNeeded == true && this.email == "" && this.address == null) { | ||||
|         if (this.receiptNeeded == true && this.address == null) { | ||||
|             throw new DonorReceiptAddressNeededError() | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -1,4 +1,5 @@ | ||||
| import { IsBoolean, IsInt, IsOptional } from 'class-validator'; | ||||
| import { DonorReceiptAddressNeededError } from '../../errors/DonorErrors'; | ||||
| import { Donor } from '../entities/Donor'; | ||||
| import { CreateParticipant } from './CreateParticipant'; | ||||
|  | ||||
| @@ -34,6 +35,10 @@ export class UpdateDonor extends CreateParticipant { | ||||
|         donor.receiptNeeded = this.receiptNeeded; | ||||
|         donor.address = await this.getAddress(); | ||||
|  | ||||
|         if (this.receiptNeeded == true && this.address == null) { | ||||
|             throw new DonorReceiptAddressNeededError() | ||||
|         } | ||||
|  | ||||
|         return donor; | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user