Skip to content

Commit

Permalink
fix: removal of AI config on settings change (#1221)
Browse files Browse the repository at this point in the history
  • Loading branch information
kpodp0ra authored Jan 6, 2025
1 parent 0672e42 commit 1c173aa
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions apps/nestjs-backend/src/features/setting/setting.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@ export class SettingService {

async updateSetting(updateSettingRo: IUpdateSettingRo) {
const setting = await this.getSetting();

const data: object = updateSettingRo;
if ('aiConfig' in data) {
// if statement to prevent "aiConfig" removal in case that field is not provided
data['aiConfig'] = updateSettingRo.aiConfig ? JSON.stringify(updateSettingRo.aiConfig) : null;
}

return await this.prismaService.setting.update({
where: { instanceId: setting.instanceId },
data: {
...updateSettingRo,
aiConfig: updateSettingRo.aiConfig ? JSON.stringify(updateSettingRo.aiConfig) : null,
},
data,
});
}
}

0 comments on commit 1c173aa

Please sign in to comment.