parent
9dc9ce37d8
commit
57b9c2babc
@ -34,7 +34,8 @@ export class UpdateDonor extends CreateParticipant {
|
|||||||
donor.phone = this.phone;
|
donor.phone = this.phone;
|
||||||
donor.email = this.email;
|
donor.email = this.email;
|
||||||
donor.receiptNeeded = this.receiptNeeded;
|
donor.receiptNeeded = this.receiptNeeded;
|
||||||
donor.address = this.address;
|
if (!this.address) { donor.address.reset(); }
|
||||||
|
else { donor.address = this.address; }
|
||||||
Address.validate(donor.address);
|
Address.validate(donor.address);
|
||||||
if (this.receiptNeeded == true && Address.isValidAddress(donor.address) == false) {
|
if (this.receiptNeeded == true && Address.isValidAddress(donor.address) == false) {
|
||||||
throw new DonorReceiptAddressNeededError()
|
throw new DonorReceiptAddressNeededError()
|
||||||
|
@ -36,7 +36,8 @@ export class UpdateRunner extends CreateParticipant {
|
|||||||
runner.phone = this.phone;
|
runner.phone = this.phone;
|
||||||
runner.email = this.email;
|
runner.email = this.email;
|
||||||
runner.group = await this.getGroup();
|
runner.group = await this.getGroup();
|
||||||
runner.address = this.address;
|
if (!this.address) { runner.address.reset(); }
|
||||||
|
else { runner.address = this.address; }
|
||||||
Address.validate(runner.address);
|
Address.validate(runner.address);
|
||||||
|
|
||||||
return runner;
|
return runner;
|
||||||
|
@ -29,7 +29,8 @@ export class UpdateRunnerOrganisation extends CreateRunnerGroup {
|
|||||||
|
|
||||||
organisation.name = this.name;
|
organisation.name = this.name;
|
||||||
organisation.contact = await this.getContact();
|
organisation.contact = await this.getContact();
|
||||||
organisation.address = this.address;
|
if (!this.address) { organisation.address.reset(); }
|
||||||
|
else { organisation.address = this.address; }
|
||||||
Address.validate(organisation.address);
|
Address.validate(organisation.address);
|
||||||
|
|
||||||
return organisation;
|
return organisation;
|
||||||
|
@ -58,6 +58,14 @@ export class Address {
|
|||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
country: string;
|
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
|
* Checks if this is a valid address
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user