From f1485f2449bc3f728851dfc4318bb72ba46dd4a7 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 5 Jul 2025 18:54:29 +0200 Subject: [PATCH] Deprecate ITEM activity type in favor of BUY --- apps/api/src/app/order/order.service.ts | 13 +++++++------ .../create-or-update-activity-dialog.component.ts | 6 +++++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/apps/api/src/app/order/order.service.ts b/apps/api/src/app/order/order.service.ts index 0c803d3d2..9c96af865 100644 --- a/apps/api/src/app/order/order.service.ts +++ b/apps/api/src/app/order/order.service.ts @@ -652,11 +652,12 @@ export class OrderService { (data.SymbolProfile.connect.dataSource_symbol.dataSource === 'MANUAL' && data.type === 'BUY') ) { - delete data.SymbolProfile.connect; - if (data.account?.connect?.id_userId?.id === null) { data.account = { disconnect: true }; } + + delete data.SymbolProfile.connect; + delete data.SymbolProfile.update.name; } else { delete data.SymbolProfile.update; @@ -685,11 +686,12 @@ export class OrderService { // Remove existing tags await this.prismaService.order.update({ - data: { tags: { set: [] } }, - where + where, + data: { tags: { set: [] } } }); const order = await this.prismaService.order.update({ + where, data: { ...data, isDraft, @@ -698,8 +700,7 @@ export class OrderService { return { id }; }) } - }, - where + } }); this.eventEmitter.emit( 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 eaa1b469b..2aa0c40ef 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 @@ -290,7 +290,11 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { .get('type') .valueChanges.pipe(takeUntil(this.unsubscribeSubject)) .subscribe((type: Type) => { - if (type === 'ITEM') { + if ( + type === 'ITEM' || + (this.activityForm.get('dataSource').value === 'MANUAL' && + type === 'BUY') + ) { this.activityForm .get('accountId') .removeValidators(Validators.required);