diff --git a/src/models/actions/update/UpdateRunnerOrganisation.ts b/src/models/actions/update/UpdateRunnerOrganisation.ts index 4116d66..ade982c 100644 --- a/src/models/actions/update/UpdateRunnerOrganisation.ts +++ b/src/models/actions/update/UpdateRunnerOrganisation.ts @@ -1,4 +1,4 @@ -import { IsBoolean, IsInt, IsNotEmpty, IsObject, IsOptional } from 'class-validator'; +import { IsBoolean, IsInt, IsObject, IsOptional } from 'class-validator'; import * as uuid from 'uuid'; import { Address } from '../../entities/Address'; import { RunnerOrganisation } from '../../entities/RunnerOrganisation'; @@ -26,9 +26,9 @@ export class UpdateRunnerOrganisation extends CreateRunnerGroup { /** * Is registration enabled for the updated organisation? */ - @IsNotEmpty() + @IsOptional() @IsBoolean() - registrationEnabled: boolean; + registrationEnabled?: boolean = false; /** * Updates a provided RunnerOrganisation entity based on this. @@ -41,7 +41,7 @@ export class UpdateRunnerOrganisation extends CreateRunnerGroup { else { organisation.address = this.address; } Address.validate(organisation.address); - if (this.registrationEnabled) { + if (this.registrationEnabled && !organisation.key) { organisation.key = uuid.v4().toUpperCase(); } else {