From 8e000baef2ea44ddf0242026b8ddf1733174526c Mon Sep 17 00:00:00 2001 From: Francisco Silva Date: Thu, 11 May 2023 09:11:44 +0200 Subject: [PATCH] fix update activity, hide update cash balance on edit (#1959) * Fix update activity, hide update cash balance on edit * Update changelog --- CHANGELOG.md | 4 ++++ apps/api/src/app/order/create-order.dto.ts | 2 +- apps/api/src/app/order/update-order.dto.ts | 4 ---- .../create-or-update-activity-dialog.component.ts | 7 ++++--- .../create-or-update-activity-dialog.html | 10 +++++++--- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a753aab6a..fed801e1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Improved the market price on the first buy date in the chart of the position detail dialog - Restructured the admin control panel with a new settings tab +### Fixed + +- Fixed an error that occurred while editing an activity caused by the cash balance update + ## 1.268.0 - 2023-05-08 ### Added diff --git a/apps/api/src/app/order/create-order.dto.ts b/apps/api/src/app/order/create-order.dto.ts index e43d1dad4..49b193ca5 100644 --- a/apps/api/src/app/order/create-order.dto.ts +++ b/apps/api/src/app/order/create-order.dto.ts @@ -68,5 +68,5 @@ export class CreateOrderDto { @IsBoolean() @IsOptional() - updateAccountBalance: boolean; + updateAccountBalance?: boolean; } diff --git a/apps/api/src/app/order/update-order.dto.ts b/apps/api/src/app/order/update-order.dto.ts index 6802c1357..a8c33c40e 100644 --- a/apps/api/src/app/order/update-order.dto.ts +++ b/apps/api/src/app/order/update-order.dto.ts @@ -67,8 +67,4 @@ export class UpdateOrderDto { @IsNumber() unitPrice: number; - - @IsBoolean() - @IsOptional() - updateAccountBalance: boolean; } diff --git a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts index 4336e9417..4f7b8aa92 100644 --- a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts +++ b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts @@ -415,13 +415,14 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { : this.activityForm.controls['searchSymbol'].value.symbol, tags: this.activityForm.controls['tags'].value, type: this.activityForm.controls['type'].value, - unitPrice: this.activityForm.controls['unitPrice'].value, - updateAccountBalance: - this.activityForm.controls['updateAccountBalance'].value + unitPrice: this.activityForm.controls['unitPrice'].value }; if (this.data.activity.id) { (activity as UpdateOrderDto).id = this.data.activity.id; + } else { + (activity as CreateOrderDto).updateAccountBalance = + this.activityForm.controls['updateAccountBalance'].value; } this.dialogRef.close({ activity }); diff --git a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.html b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.html index 9ad56c907..5bbf30ac3 100644 --- a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.html +++ b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.html @@ -18,8 +18,12 @@ -
- +
+ Account
-
+
Update Cash Balance