fix: address comments

This commit is contained in:
abdou6666
2024-12-30 09:44:17 +01:00
parent 7a8a8fa151
commit 1e2fb1cfba
3 changed files with 11 additions and 7 deletions

View File

@@ -52,11 +52,16 @@ export class SettingRepository extends BaseRepository<Setting> {
if (payload && 'value' in payload) {
const hasType = 'type' in payload;
if (hasType) {
// Case when we need to update both the type and value
this.validateSettingValue(payload.type, payload.value);
} else {
// Case when we only update the setting value
const setting = await this.findOne(criteria);
if (setting && 'type' in setting)
if (setting && 'type' in setting) {
this.validateSettingValue(setting.type, payload.value);
} else {
throw new Error('Unable to find the setting to be updated');
}
}
}
}

View File

@@ -77,7 +77,7 @@ export interface NumberSetting extends Setting {
type: SettingType.number;
value: number;
options: never;
config: {
config?: {
min: number;
max: number;
step: number;