@@ -29,7 +29,7 @@ export class CreateDonor extends CreateParticipant {
|
||||
newDonor.email = this.email;
|
||||
newDonor.receiptNeeded = this.receiptNeeded;
|
||||
newDonor.address = this.address;
|
||||
|
||||
Address.validate(newDonor.address);
|
||||
if (this.receiptNeeded == true && Address.isValidAddress(newDonor.address) == false) {
|
||||
throw new DonorReceiptAddressNeededError()
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ export class CreateGroupContact {
|
||||
contact.email = this.email;
|
||||
contact.phone = this.phone;
|
||||
contact.address = this.address;
|
||||
return null;
|
||||
Address.validate(contact.address);
|
||||
return contact;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import { getConnectionManager } from 'typeorm';
|
||||
import { RunnerGroupNotFoundError } from '../../../errors/RunnerGroupErrors';
|
||||
import { RunnerOrganisationWrongTypeError } from '../../../errors/RunnerOrganisationErrors';
|
||||
import { RunnerTeamNeedsParentError } from '../../../errors/RunnerTeamErrors';
|
||||
import { Address } from '../../entities/Address';
|
||||
import { Runner } from '../../entities/Runner';
|
||||
import { RunnerGroup } from '../../entities/RunnerGroup';
|
||||
import { CreateParticipant } from './CreateParticipant';
|
||||
@@ -31,6 +32,7 @@ export class CreateRunner extends CreateParticipant {
|
||||
newRunner.email = this.email;
|
||||
newRunner.group = await this.getGroup();
|
||||
newRunner.address = this.address;
|
||||
Address.validate(newRunner.address);
|
||||
|
||||
return newRunner;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ export class CreateRunnerOrganisation extends CreateRunnerGroup {
|
||||
newRunnerOrganisation.name = this.name;
|
||||
newRunnerOrganisation.contact = await this.getContact();
|
||||
newRunnerOrganisation.address = this.address;
|
||||
Address.validate(newRunnerOrganisation.address);
|
||||
|
||||
return newRunnerOrganisation;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ export class UpdateDonor extends CreateParticipant {
|
||||
donor.email = this.email;
|
||||
donor.receiptNeeded = this.receiptNeeded;
|
||||
donor.address = this.address;
|
||||
Address.validate(donor.address);
|
||||
if (this.receiptNeeded == true && Address.isValidAddress(donor.address) == false) {
|
||||
throw new DonorReceiptAddressNeededError()
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { IsInt, IsPositive } from 'class-validator';
|
||||
import { getConnectionManager } from 'typeorm';
|
||||
import { RunnerGroupNotFoundError } from '../../../errors/RunnerGroupErrors';
|
||||
import { RunnerTeamNeedsParentError } from '../../../errors/RunnerTeamErrors';
|
||||
import { Address } from '../../entities/Address';
|
||||
import { Runner } from '../../entities/Runner';
|
||||
import { RunnerGroup } from '../../entities/RunnerGroup';
|
||||
import { CreateParticipant } from '../create/CreateParticipant';
|
||||
@@ -36,6 +37,7 @@ export class UpdateRunner extends CreateParticipant {
|
||||
runner.email = this.email;
|
||||
runner.group = await this.getGroup();
|
||||
runner.address = this.address;
|
||||
Address.validate(runner.address);
|
||||
|
||||
return runner;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ export class UpdateRunnerOrganisation extends CreateRunnerGroup {
|
||||
organisation.name = this.name;
|
||||
organisation.contact = await this.getContact();
|
||||
organisation.address = this.address;
|
||||
Address.validate(organisation.address);
|
||||
|
||||
return organisation;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user