parent
e96637219f
commit
97c01ce81a
@ -18,21 +18,17 @@ export class UpdateRunnerOrganisation extends CreateRunnerGroup {
|
|||||||
id: number;
|
id: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The updated organisation's address.
|
* The updated organisation's address's id.
|
||||||
* Just has to contain the address's id - everything else won't be checked or changed.
|
|
||||||
* Optional.
|
|
||||||
*/
|
*/
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
address?: Address;
|
address?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the organisation's address based on it's id.
|
* Loads the organisation's address based on it's id.
|
||||||
*/
|
*/
|
||||||
public async getAddress(): Promise<Address> {
|
public async getAddress(): Promise<Address> {
|
||||||
if (this.address === undefined || this.address === null) {
|
if (!this.address) { return null; }
|
||||||
return null;
|
|
||||||
}
|
|
||||||
let address = await getConnectionManager().get().getRepository(Address).findOne({ id: this.address.id });
|
let address = await getConnectionManager().get().getRepository(Address).findOne({ id: this.address.id });
|
||||||
if (!address) { throw new AddressNotFoundError; }
|
if (!address) { throw new AddressNotFoundError; }
|
||||||
return address;
|
return address;
|
||||||
@ -45,7 +41,7 @@ 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 = await this.getAddress();
|
organisation.address = await this.getAddress();
|
||||||
|
|
||||||
return organisation;
|
return organisation;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user