First feature version 0.1.0 #102

Merged
niggl merged 39 commits from dev into main 2021-01-15 19:31:43 +00:00
Showing only changes of commit 97c01ce81a - Show all commits

View File

@ -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;
}