From b9f0374abc8900723b1fd9473eb05b0a3093f599 Mon Sep 17 00:00:00 2001 From: Shaunak Das <51281688+shaun-ak@users.noreply.github.com> Date: Sun, 29 Sep 2024 10:48:45 +0530 Subject: [PATCH] address pr comments --- .../src/app/user/update-user-setting.dto.ts | 3 --- .../rule-settings-dialog.html | 6 +----- .../src/app/components/rule/rule.component.ts | 21 +++++++++---------- .../lib/types/x-ray-rules-settings.type.ts | 4 +++- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/apps/api/src/app/user/update-user-setting.dto.ts b/apps/api/src/app/user/update-user-setting.dto.ts index 09e9cc75a..b4d3edb77 100644 --- a/apps/api/src/app/user/update-user-setting.dto.ts +++ b/apps/api/src/app/user/update-user-setting.dto.ts @@ -89,9 +89,6 @@ export class UpdateUserSettingDto { @IsOptional() locale?: string; - @IsOptional() - portfolioSettings?: PortfolioReportRule['settings']; - @IsNumber() @IsOptional() projectedTotalAmount?: number; diff --git a/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.html b/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.html index 2a968195d..ef86549f6 100644 --- a/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.html +++ b/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.html @@ -31,11 +31,7 @@
-
diff --git a/apps/client/src/app/components/rule/rule.component.ts b/apps/client/src/app/components/rule/rule.component.ts index 90196e897..a68ea7bd7 100644 --- a/apps/client/src/app/components/rule/rule.component.ts +++ b/apps/client/src/app/components/rule/rule.component.ts @@ -55,18 +55,17 @@ export class RuleComponent implements OnInit { dialogRef .afterClosed() .pipe(takeUntil(this.unsubscribeSubject)) - .subscribe( - ({ settings }: { settings: PortfolioReportRule['settings'] }) => { - if (settings) { - const updatedSettings: UpdateUserSettingDto = { - portfolioSettings: { - ...settings - } - }; - this.ruleUpdated.emit(updatedSettings); - } + .subscribe((settings: PortfolioReportRule['settings']) => { + if (settings) { + const updatedSettings: UpdateUserSettingDto = { + xRayRules: { + [rule.key]: settings + } + }; + + this.ruleUpdated.emit(updatedSettings); } - ); + }); } public onUpdateRule(rule: PortfolioReportRule) { diff --git a/libs/common/src/lib/types/x-ray-rules-settings.type.ts b/libs/common/src/lib/types/x-ray-rules-settings.type.ts index bc2782547..2125e3fe7 100644 --- a/libs/common/src/lib/types/x-ray-rules-settings.type.ts +++ b/libs/common/src/lib/types/x-ray-rules-settings.type.ts @@ -1,3 +1,5 @@ +import { PortfolioReportRule } from '../interfaces'; + export type XRayRulesSettings = { AccountClusterRiskCurrentInvestment?: RuleSettings; AccountClusterRiskSingleAccount?: RuleSettings; @@ -7,6 +9,6 @@ export type XRayRulesSettings = { FeeRatioInitialInvestment?: RuleSettings; }; -interface RuleSettings { +interface RuleSettings extends Pick { isActive: boolean; }