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