Marked param as optional (default: false)

ref #112
This commit is contained in:
Nicolai Ort 2021-01-21 19:08:43 +01:00
parent a9843ed459
commit f8d7544517

View File

@ -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 * as uuid from 'uuid';
import { Address } from '../../entities/Address'; import { Address } from '../../entities/Address';
import { RunnerOrganisation } from '../../entities/RunnerOrganisation'; import { RunnerOrganisation } from '../../entities/RunnerOrganisation';
@ -26,9 +26,9 @@ export class UpdateRunnerOrganisation extends CreateRunnerGroup {
/** /**
* Is registration enabled for the updated organisation? * Is registration enabled for the updated organisation?
*/ */
@IsNotEmpty() @IsOptional()
@IsBoolean() @IsBoolean()
registrationEnabled: boolean; registrationEnabled?: boolean = false;
/** /**
* Updates a provided RunnerOrganisation entity based on this. * Updates a provided RunnerOrganisation entity based on this.
@ -41,7 +41,7 @@ export class UpdateRunnerOrganisation extends CreateRunnerGroup {
else { organisation.address = this.address; } else { organisation.address = this.address; }
Address.validate(organisation.address); Address.validate(organisation.address);
if (this.registrationEnabled) { if (this.registrationEnabled && !organisation.key) {
organisation.key = uuid.v4().toUpperCase(); organisation.key = uuid.v4().toUpperCase();
} }
else { else {