Merge branch 'fixBadvalue' into 'main'

Fix bad value assignment

See merge request v3/service/configuration!35
This commit is contained in:
Sylvain Briat 2023-11-16 09:38:48 +00:00
commit 41ed0fcec7
3 changed files with 9 additions and 4 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@mobicoop/configuration",
"version": "2.5.1",
"version": "2.5.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@mobicoop/configuration",
"version": "2.5.1",
"version": "2.5.2",
"license": "AGPL",
"dependencies": {
"@grpc/grpc-js": "^1.9.9",

View File

@ -1,6 +1,6 @@
{
"name": "@mobicoop/configuration",
"version": "2.5.1",
"version": "2.5.2",
"description": "Mobicoop V3 Configuration Service",
"author": "sbriat",
"private": true,

View File

@ -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,