mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix: address comments
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ export interface NumberSetting extends Setting {
|
||||
type: SettingType.number;
|
||||
value: number;
|
||||
options: never;
|
||||
config: {
|
||||
config?: {
|
||||
min: number;
|
||||
max: number;
|
||||
step: number;
|
||||
|
||||
Reference in New Issue
Block a user