From 7dcc965f4db09e170685a82010f74309f8dc2f2c Mon Sep 17 00:00:00 2001 From: Sylvain Briat Date: Thu, 16 Nov 2023 10:31:20 +0100 Subject: [PATCH] fix bad value assignment --- .../set-configuration/set-configuration.service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/configuration/core/application/commands/set-configuration/set-configuration.service.ts b/src/modules/configuration/core/application/commands/set-configuration/set-configuration.service.ts index d17e483..4755bfc 100644 --- a/src/modules/configuration/core/application/commands/set-configuration/set-configuration.service.ts +++ b/src/modules/configuration/core/application/commands/set-configuration/set-configuration.service.ts @@ -29,7 +29,12 @@ export class SetConfigurationService implements ICommandHandler { `${command.value}`, configurationType, ); - if (isNaN(value)) throw new ArgumentInvalidException('Bad value'); + if ( + (configurationType === ConfigurationType.INT || + configurationType === ConfigurationType.FLOAT) && + isNaN(value) + ) + throw new ArgumentInvalidException('Bad value'); return await this.configurationRepository.set( command.configurationIdentifier.domain, command.configurationIdentifier.key,