fix: boolean config variables can't be set to false

This commit is contained in:
Elias Schneider
2023-04-07 23:13:44 +02:00
parent b7db9b9b40
commit 39a74510c1

View File

@@ -81,7 +81,7 @@ export class ConfigService {
if (!configVariable || configVariable.locked) if (!configVariable || configVariable.locked)
throw new NotFoundException("Config variable not found"); throw new NotFoundException("Config variable not found");
if (value == "") { if (value === "") {
value = null; value = null;
} else if ( } else if (
typeof value != configVariable.type && typeof value != configVariable.type &&
@@ -100,7 +100,7 @@ export class ConfigService {
name: key.split(".")[1], name: key.split(".")[1],
}, },
}, },
data: { value: value ? value.toString() : null }, data: { value: value === null ? null : value.toString() },
}); });
this.configVariables = await this.prisma.config.findMany(); this.configVariables = await this.prisma.config.findMany();