| @@ -34,7 +34,8 @@ export class UpdateDonor extends CreateParticipant { | ||||
|         donor.phone = this.phone; | ||||
|         donor.email = this.email; | ||||
|         donor.receiptNeeded = this.receiptNeeded; | ||||
|         donor.address = this.address; | ||||
|         if (!this.address) { donor.address.reset(); } | ||||
|         else { donor.address = this.address; } | ||||
|         Address.validate(donor.address); | ||||
|         if (this.receiptNeeded == true && Address.isValidAddress(donor.address) == false) { | ||||
|             throw new DonorReceiptAddressNeededError() | ||||
|   | ||||
| @@ -36,7 +36,8 @@ export class UpdateRunner extends CreateParticipant { | ||||
|         runner.phone = this.phone; | ||||
|         runner.email = this.email; | ||||
|         runner.group = await this.getGroup(); | ||||
|         runner.address = this.address; | ||||
|         if (!this.address) { runner.address.reset(); } | ||||
|         else { runner.address = this.address; } | ||||
|         Address.validate(runner.address); | ||||
|  | ||||
|         return runner; | ||||
|   | ||||
| @@ -29,7 +29,8 @@ export class UpdateRunnerOrganisation extends CreateRunnerGroup { | ||||
|  | ||||
|         organisation.name = this.name; | ||||
|         organisation.contact = await this.getContact(); | ||||
|         organisation.address = this.address; | ||||
|         if (!this.address) { organisation.address.reset(); } | ||||
|         else { organisation.address = this.address; } | ||||
|         Address.validate(organisation.address); | ||||
|  | ||||
|         return organisation; | ||||
|   | ||||
| @@ -58,6 +58,14 @@ export class Address { | ||||
|   @IsNotEmpty() | ||||
|   country: string; | ||||
|  | ||||
|   public reset() { | ||||
|     this.address1 = null; | ||||
|     this.address2 = null; | ||||
|     this.city = null; | ||||
|     this.country = null; | ||||
|     this.postalcode = null; | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * Checks if this is a valid address | ||||
|    */ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user