From 73f009e43b26ebacd8a39eaf6b880824aaaf4719 Mon Sep 17 00:00:00 2001 From: Kenrick Tandrian <60643640+KenTandrian@users.noreply.github.com> Date: Wed, 30 Apr 2025 16:00:03 +0700 Subject: [PATCH 1/5] Feature/extend GUI to delete watchlist item (#4624) * Extend GUI to delete watchlist item * Update changelog --- CHANGELOG.md | 6 ++++ .../home-watchlist.component.ts | 25 ++++++++++++- .../home-watchlist/home-watchlist.html | 2 ++ apps/client/src/app/services/data.service.ts | 4 +++ .../lib/benchmark/benchmark.component.html | 33 +++++++++++++++++ .../src/lib/benchmark/benchmark.component.ts | 35 +++++++++++++++++-- 6 files changed, 101 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3850390e..d103ff6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Added + +- Added support to delete an asset from the watchlist (experimental) + ## 2.157.1 - 2025-04-29 ### Added diff --git a/apps/client/src/app/components/home-watchlist/home-watchlist.component.ts b/apps/client/src/app/components/home-watchlist/home-watchlist.component.ts index 0198ab27..daf512b3 100644 --- a/apps/client/src/app/components/home-watchlist/home-watchlist.component.ts +++ b/apps/client/src/app/components/home-watchlist/home-watchlist.component.ts @@ -1,6 +1,10 @@ import { DataService } from '@ghostfolio/client/services/data.service'; import { UserService } from '@ghostfolio/client/services/user/user.service'; -import { Benchmark, User } from '@ghostfolio/common/interfaces'; +import { + AssetProfileIdentifier, + Benchmark, + User +} from '@ghostfolio/common/interfaces'; import { hasPermission, permissions } from '@ghostfolio/common/permissions'; import { GfBenchmarkComponent } from '@ghostfolio/ui/benchmark'; import { GfPremiumIndicatorComponent } from '@ghostfolio/ui/premium-indicator'; @@ -41,6 +45,7 @@ import { CreateWatchlistItemDialogParams } from './create-watchlist-item-dialog/ export class HomeWatchlistComponent implements OnDestroy, OnInit { public deviceType: string; public hasPermissionToCreateWatchlistItem: boolean; + public hasPermissionToDeleteWatchlistItem: boolean; public user: User; public watchlist: Benchmark[]; @@ -75,6 +80,10 @@ export class HomeWatchlistComponent implements OnDestroy, OnInit { this.user.permissions, permissions.createWatchlistItem ); + this.hasPermissionToDeleteWatchlistItem = hasPermission( + this.user.permissions, + permissions.deleteWatchlistItem + ); this.changeDetectorRef.markForCheck(); } @@ -85,6 +94,20 @@ export class HomeWatchlistComponent implements OnDestroy, OnInit { this.loadWatchlistData(); } + public onWatchlistItemDeleted({ + dataSource, + symbol + }: AssetProfileIdentifier) { + this.dataService + .deleteWatchlistItem({ dataSource, symbol }) + .pipe(takeUntil(this.unsubscribeSubject)) + .subscribe({ + next: () => { + return this.loadWatchlistData(); + } + }); + } + public ngOnDestroy() { this.unsubscribeSubject.next(); this.unsubscribeSubject.complete(); diff --git a/apps/client/src/app/components/home-watchlist/home-watchlist.html b/apps/client/src/app/components/home-watchlist/home-watchlist.html index 0a2e3727..ef073d33 100644 --- a/apps/client/src/app/components/home-watchlist/home-watchlist.html +++ b/apps/client/src/app/components/home-watchlist/home-watchlist.html @@ -12,8 +12,10 @@ diff --git a/apps/client/src/app/services/data.service.ts b/apps/client/src/app/services/data.service.ts index 526c6197..353bc415 100644 --- a/apps/client/src/app/services/data.service.ts +++ b/apps/client/src/app/services/data.service.ts @@ -327,6 +327,10 @@ export class DataService { return this.http.delete(`/api/v1/user/${aId}`); } + public deleteWatchlistItem({ dataSource, symbol }: AssetProfileIdentifier) { + return this.http.delete(`/api/v1/watchlist/${dataSource}/${symbol}`); + } + public fetchAccesses() { return this.http.get('/api/v1/access'); } diff --git a/libs/ui/src/lib/benchmark/benchmark.component.html b/libs/ui/src/lib/benchmark/benchmark.component.html index 270690f3..14ff7f9f 100644 --- a/libs/ui/src/lib/benchmark/benchmark.component.html +++ b/libs/ui/src/lib/benchmark/benchmark.component.html @@ -113,6 +113,39 @@ + + + + @if (hasPermissionToDeleteItem) { + + } + + + + + + (); + + public displayedColumns = [ + 'name', + 'date', + 'change', + 'marketCondition', + 'actions' + ]; public isLoading = true; public isNumber = isNumber; public resolveMarketCondition = resolveMarketCondition; @@ -58,6 +75,7 @@ export class GfBenchmarkComponent implements OnChanges, OnDestroy { public constructor( private dialog: MatDialog, + private notificationService: NotificationService, private route: ActivatedRoute, private router: Router ) { @@ -89,11 +107,22 @@ export class GfBenchmarkComponent implements OnChanges, OnDestroy { 'trend200d', 'date', 'change', - 'marketCondition' + 'marketCondition', + 'actions' ]; } } + public onDeleteItem({ dataSource, symbol }: AssetProfileIdentifier) { + this.notificationService.confirm({ + confirmFn: () => { + this.itemDeleted.emit({ dataSource, symbol }); + }, + confirmType: ConfirmationDialogType.Warn, + title: $localize`Do you really want to delete this item?` + }); + } + public onOpenBenchmarkDialog({ dataSource, symbol }: AssetProfileIdentifier) { this.router.navigate([], { queryParams: { dataSource, symbol, benchmarkDetailDialog: true } From 8df966797936b2d2681fa0169c2adf7147deca4d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 30 Apr 2025 16:59:50 +0200 Subject: [PATCH 2/5] Feature/update locales (#4629) * Update locales * Update translations * Update changelog --------- Co-authored-by: github-actions[bot] Co-authored-by: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> --- CHANGELOG.md | 4 ++++ apps/client/src/locales/messages.ca.xlf | 14 +++++++++++++- apps/client/src/locales/messages.de.xlf | 14 +++++++++++++- apps/client/src/locales/messages.es.xlf | 14 +++++++++++++- apps/client/src/locales/messages.fr.xlf | 14 +++++++++++++- apps/client/src/locales/messages.it.xlf | 14 +++++++++++++- apps/client/src/locales/messages.nl.xlf | 14 +++++++++++++- apps/client/src/locales/messages.pl.xlf | 14 +++++++++++++- apps/client/src/locales/messages.pt.xlf | 14 +++++++++++++- apps/client/src/locales/messages.tr.xlf | 14 +++++++++++++- apps/client/src/locales/messages.uk.xlf | 14 +++++++++++++- apps/client/src/locales/messages.xlf | 13 ++++++++++++- apps/client/src/locales/messages.zh.xlf | 14 +++++++++++++- 13 files changed, 159 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d103ff6e..0e591b31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added support to delete an asset from the watchlist (experimental) +### Changed + +- Improved the language localization for German (`de`) + ## 2.157.1 - 2025-04-29 ### Added diff --git a/apps/client/src/locales/messages.ca.xlf b/apps/client/src/locales/messages.ca.xlf index 504ea6e1..5dd6bfbd 100644 --- a/apps/client/src/locales/messages.ca.xlf +++ b/apps/client/src/locales/messages.ca.xlf @@ -1237,6 +1237,10 @@ libs/ui/src/lib/activities-table/activities-table.component.html 457 + + libs/ui/src/lib/benchmark/benchmark.component.html + 142 + Do you really want to delete this account? @@ -4959,7 +4963,7 @@ libs/ui/src/lib/benchmark/benchmark.component.html - 141 + 174 libs/ui/src/lib/top-holdings/top-holdings.component.html @@ -7961,6 +7965,14 @@ 29 + + Do you really want to delete this item? + Do you really want to delete this item? + + libs/ui/src/lib/benchmark/benchmark.component.ts + 122 + + diff --git a/apps/client/src/locales/messages.de.xlf b/apps/client/src/locales/messages.de.xlf index 8612e948..00ad0143 100644 --- a/apps/client/src/locales/messages.de.xlf +++ b/apps/client/src/locales/messages.de.xlf @@ -300,6 +300,10 @@ libs/ui/src/lib/activities-table/activities-table.component.html 457 + + libs/ui/src/lib/benchmark/benchmark.component.html + 142 + Do you really want to delete this account? @@ -4686,7 +4690,7 @@ libs/ui/src/lib/benchmark/benchmark.component.html - 141 + 174 libs/ui/src/lib/top-holdings/top-holdings.component.html @@ -7961,6 +7965,14 @@ 29 + + Do you really want to delete this item? + Möchtest du diesen Eintrag wirklich löschen? + + libs/ui/src/lib/benchmark/benchmark.component.ts + 122 + + diff --git a/apps/client/src/locales/messages.es.xlf b/apps/client/src/locales/messages.es.xlf index e297e002..46bd07d4 100644 --- a/apps/client/src/locales/messages.es.xlf +++ b/apps/client/src/locales/messages.es.xlf @@ -301,6 +301,10 @@ libs/ui/src/lib/activities-table/activities-table.component.html 457 + + libs/ui/src/lib/benchmark/benchmark.component.html + 142 + Do you really want to delete this account? @@ -4663,7 +4667,7 @@ libs/ui/src/lib/benchmark/benchmark.component.html - 141 + 174 libs/ui/src/lib/top-holdings/top-holdings.component.html @@ -7962,6 +7966,14 @@ 29 + + Do you really want to delete this item? + Do you really want to delete this item? + + libs/ui/src/lib/benchmark/benchmark.component.ts + 122 + + diff --git a/apps/client/src/locales/messages.fr.xlf b/apps/client/src/locales/messages.fr.xlf index 376a7cb3..a9b3cd04 100644 --- a/apps/client/src/locales/messages.fr.xlf +++ b/apps/client/src/locales/messages.fr.xlf @@ -356,6 +356,10 @@ libs/ui/src/lib/activities-table/activities-table.component.html 457 + + libs/ui/src/lib/benchmark/benchmark.component.html + 142 + Do you really want to delete this account? @@ -4662,7 +4666,7 @@ libs/ui/src/lib/benchmark/benchmark.component.html - 141 + 174 libs/ui/src/lib/top-holdings/top-holdings.component.html @@ -7961,6 +7965,14 @@ 29 + + Do you really want to delete this item? + Do you really want to delete this item? + + libs/ui/src/lib/benchmark/benchmark.component.ts + 122 + + diff --git a/apps/client/src/locales/messages.it.xlf b/apps/client/src/locales/messages.it.xlf index 52beb2cb..cbc8d579 100644 --- a/apps/client/src/locales/messages.it.xlf +++ b/apps/client/src/locales/messages.it.xlf @@ -301,6 +301,10 @@ libs/ui/src/lib/activities-table/activities-table.component.html 457 + + libs/ui/src/lib/benchmark/benchmark.component.html + 142 + Do you really want to delete this account? @@ -4663,7 +4667,7 @@ libs/ui/src/lib/benchmark/benchmark.component.html - 141 + 174 libs/ui/src/lib/top-holdings/top-holdings.component.html @@ -7962,6 +7966,14 @@ 29 + + Do you really want to delete this item? + Do you really want to delete this item? + + libs/ui/src/lib/benchmark/benchmark.component.ts + 122 + + diff --git a/apps/client/src/locales/messages.nl.xlf b/apps/client/src/locales/messages.nl.xlf index b4c31251..d53e7845 100644 --- a/apps/client/src/locales/messages.nl.xlf +++ b/apps/client/src/locales/messages.nl.xlf @@ -300,6 +300,10 @@ libs/ui/src/lib/activities-table/activities-table.component.html 457 + + libs/ui/src/lib/benchmark/benchmark.component.html + 142 + Do you really want to delete this account? @@ -4662,7 +4666,7 @@ libs/ui/src/lib/benchmark/benchmark.component.html - 141 + 174 libs/ui/src/lib/top-holdings/top-holdings.component.html @@ -7961,6 +7965,14 @@ 29 + + Do you really want to delete this item? + Do you really want to delete this item? + + libs/ui/src/lib/benchmark/benchmark.component.ts + 122 + + diff --git a/apps/client/src/locales/messages.pl.xlf b/apps/client/src/locales/messages.pl.xlf index ef5caf61..85ef03d3 100644 --- a/apps/client/src/locales/messages.pl.xlf +++ b/apps/client/src/locales/messages.pl.xlf @@ -1165,6 +1165,10 @@ libs/ui/src/lib/activities-table/activities-table.component.html 457 + + libs/ui/src/lib/benchmark/benchmark.component.html + 142 + Do you really want to delete this account? @@ -4571,7 +4575,7 @@ libs/ui/src/lib/benchmark/benchmark.component.html - 141 + 174 libs/ui/src/lib/top-holdings/top-holdings.component.html @@ -7961,6 +7965,14 @@ 29 + + Do you really want to delete this item? + Do you really want to delete this item? + + libs/ui/src/lib/benchmark/benchmark.component.ts + 122 + + diff --git a/apps/client/src/locales/messages.pt.xlf b/apps/client/src/locales/messages.pt.xlf index b4d2510b..d270243d 100644 --- a/apps/client/src/locales/messages.pt.xlf +++ b/apps/client/src/locales/messages.pt.xlf @@ -356,6 +356,10 @@ libs/ui/src/lib/activities-table/activities-table.component.html 457 + + libs/ui/src/lib/benchmark/benchmark.component.html + 142 + Do you really want to delete this account? @@ -4662,7 +4666,7 @@ libs/ui/src/lib/benchmark/benchmark.component.html - 141 + 174 libs/ui/src/lib/top-holdings/top-holdings.component.html @@ -7961,6 +7965,14 @@ 29 + + Do you really want to delete this item? + Do you really want to delete this item? + + libs/ui/src/lib/benchmark/benchmark.component.ts + 122 + + diff --git a/apps/client/src/locales/messages.tr.xlf b/apps/client/src/locales/messages.tr.xlf index 47a489c6..9ec4a583 100644 --- a/apps/client/src/locales/messages.tr.xlf +++ b/apps/client/src/locales/messages.tr.xlf @@ -1125,6 +1125,10 @@ libs/ui/src/lib/activities-table/activities-table.component.html 457 + + libs/ui/src/lib/benchmark/benchmark.component.html + 142 + Do you really want to delete this account? @@ -4059,7 +4063,7 @@ libs/ui/src/lib/benchmark/benchmark.component.html - 141 + 174 libs/ui/src/lib/top-holdings/top-holdings.component.html @@ -7961,6 +7965,14 @@ 29 + + Do you really want to delete this item? + Do you really want to delete this item? + + libs/ui/src/lib/benchmark/benchmark.component.ts + 122 + + diff --git a/apps/client/src/locales/messages.uk.xlf b/apps/client/src/locales/messages.uk.xlf index 6f5611d4..17a42efb 100644 --- a/apps/client/src/locales/messages.uk.xlf +++ b/apps/client/src/locales/messages.uk.xlf @@ -1253,6 +1253,10 @@ libs/ui/src/lib/activities-table/activities-table.component.html 457 + + libs/ui/src/lib/benchmark/benchmark.component.html + 142 + Do you really want to delete this account? @@ -5211,7 +5215,7 @@ libs/ui/src/lib/benchmark/benchmark.component.html - 141 + 174 libs/ui/src/lib/top-holdings/top-holdings.component.html @@ -7961,6 +7965,14 @@ 29 + + Do you really want to delete this item? + Do you really want to delete this item? + + libs/ui/src/lib/benchmark/benchmark.component.ts + 122 + + diff --git a/apps/client/src/locales/messages.xlf b/apps/client/src/locales/messages.xlf index cc48e408..5a96dd10 100644 --- a/apps/client/src/locales/messages.xlf +++ b/apps/client/src/locales/messages.xlf @@ -1132,6 +1132,10 @@ libs/ui/src/lib/activities-table/activities-table.component.html 457 + + libs/ui/src/lib/benchmark/benchmark.component.html + 142 + Do you really want to delete this account? @@ -4225,7 +4229,7 @@ libs/ui/src/lib/benchmark/benchmark.component.html - 141 + 174 libs/ui/src/lib/top-holdings/top-holdings.component.html @@ -7199,6 +7203,13 @@ 29 + + Do you really want to delete this item? + + libs/ui/src/lib/benchmark/benchmark.component.ts + 122 + + diff --git a/apps/client/src/locales/messages.zh.xlf b/apps/client/src/locales/messages.zh.xlf index c1c7ac5f..385b4aef 100644 --- a/apps/client/src/locales/messages.zh.xlf +++ b/apps/client/src/locales/messages.zh.xlf @@ -1174,6 +1174,10 @@ libs/ui/src/lib/activities-table/activities-table.component.html 457 + + libs/ui/src/lib/benchmark/benchmark.component.html + 142 + Do you really want to delete this account? @@ -4580,7 +4584,7 @@ libs/ui/src/lib/benchmark/benchmark.component.html - 141 + 174 libs/ui/src/lib/top-holdings/top-holdings.component.html @@ -7962,6 +7966,14 @@ 29 + + Do you really want to delete this item? + Do you really want to delete this item? + + libs/ui/src/lib/benchmark/benchmark.component.ts + 122 + + From 8fbdcac66c7b6671227e25ca8423b4b3fde71f49 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Wed, 30 Apr 2025 17:31:06 +0200 Subject: [PATCH 3/5] Feature/rename Order to activities in account database schema (#4577) * Rename Order to activities * Update changelog --- CHANGELOG.md | 1 + apps/api/src/app/account/account.controller.ts | 6 +++--- apps/api/src/app/account/account.service.ts | 14 +++++++------- apps/api/src/app/order/order.service.ts | 2 +- apps/api/src/app/portfolio/portfolio.service.ts | 10 +++++----- prisma/schema.prisma | 2 +- 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e591b31..cccc700d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Renamed `Order` to `activities` in the `Account` database schema - Improved the language localization for German (`de`) ## 2.157.1 - 2025-04-29 diff --git a/apps/api/src/app/account/account.controller.ts b/apps/api/src/app/account/account.controller.ts index c0f4dac6..71ff8a04 100644 --- a/apps/api/src/app/account/account.controller.ts +++ b/apps/api/src/app/account/account.controller.ts @@ -57,17 +57,17 @@ export class AccountController { @HasPermission(permissions.deleteAccount) @UseGuards(AuthGuard('jwt'), HasPermissionGuard) public async deleteAccount(@Param('id') id: string): Promise { - const account = await this.accountService.accountWithOrders( + const account = await this.accountService.accountWithActivities( { id_userId: { id, userId: this.request.user.id } }, - { Order: true } + { activities: true } ); - if (!account || account?.Order.length > 0) { + if (!account || account?.activities.length > 0) { throw new HttpException( getReasonPhrase(StatusCodes.FORBIDDEN), StatusCodes.FORBIDDEN diff --git a/apps/api/src/app/account/account.service.ts b/apps/api/src/app/account/account.service.ts index aab4c076..a10eecac 100644 --- a/apps/api/src/app/account/account.service.ts +++ b/apps/api/src/app/account/account.service.ts @@ -39,12 +39,12 @@ export class AccountService { return account; } - public async accountWithOrders( + public async accountWithActivities( accountWhereUniqueInput: Prisma.AccountWhereUniqueInput, accountInclude: Prisma.AccountInclude ): Promise< Account & { - Order?: Order[]; + activities?: Order[]; } > { return this.prismaService.account.findUnique({ @@ -62,8 +62,8 @@ export class AccountService { orderBy?: Prisma.AccountOrderByWithRelationInput; }): Promise< (Account & { + activities?: Order[]; balances?: AccountBalance[]; - Order?: Order[]; Platform?: Platform; })[] > { @@ -140,7 +140,7 @@ export class AccountService { public async getAccounts(aUserId: string): Promise { const accounts = await this.accounts({ - include: { Order: true, Platform: true }, + include: { activities: true, Platform: true }, orderBy: { name: 'asc' }, where: { userId: aUserId } }); @@ -148,15 +148,15 @@ export class AccountService { return accounts.map((account) => { let transactionCount = 0; - for (const order of account.Order) { - if (!order.isDraft) { + for (const { isDraft } of account.activities) { + if (!isDraft) { transactionCount += 1; } } const result = { ...account, transactionCount }; - delete result.Order; + delete result.activities; return result; }); diff --git a/apps/api/src/app/order/order.service.ts b/apps/api/src/app/order/order.service.ts index c2b822ac..d1847635 100644 --- a/apps/api/src/app/order/order.service.ts +++ b/apps/api/src/app/order/order.service.ts @@ -100,7 +100,7 @@ export class OrderService { userId: string; } ): Promise { - let Account: Prisma.AccountCreateNestedOneWithoutOrderInput; + let Account: Prisma.AccountCreateNestedOneWithoutActivitiesInput; if (data.accountId) { Account = { diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index 87b2bc9d..3aa9696b 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -139,7 +139,7 @@ export class PortfolioService { } if (filterByDataSource && filterBySymbol) { - where.Order = { + where.activities = { some: { SymbolProfile: { AND: [ @@ -154,7 +154,7 @@ export class PortfolioService { const [accounts, details] = await Promise.all([ this.accountService.accounts({ where, - include: { Order: true, Platform: true }, + include: { activities: true, Platform: true }, orderBy: { name: 'asc' } }), this.getDetails({ @@ -170,8 +170,8 @@ export class PortfolioService { return accounts.map((account) => { let transactionCount = 0; - for (const order of account.Order) { - if (!order.isDraft) { + for (const { isDraft } of account.activities) { + if (!isDraft) { transactionCount += 1; } } @@ -195,7 +195,7 @@ export class PortfolioService { ) }; - delete result.Order; + delete result.activities; return result; }); diff --git a/prisma/schema.prisma b/prisma/schema.prisma index b88a5f9f..c33f7d6c 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -26,6 +26,7 @@ model Access { } model Account { + activities Order[] balance Float @default(0) balances AccountBalance[] comment String? @@ -39,7 +40,6 @@ model Account { userId String Platform Platform? @relation(fields: [platformId], references: [id]) User User @relation(fields: [userId], onDelete: Cascade, references: [id]) - Order Order[] @@id([id, userId]) @@index([currency]) From ca992db14eb00e9dc0f6d51f7fdcb914770fea66 Mon Sep 17 00:00:00 2001 From: csehatt741 <77381875+csehatt741@users.noreply.github.com> Date: Wed, 30 Apr 2025 17:51:32 +0200 Subject: [PATCH 4/5] Bugfix/save activities with type INTEREST, ITEM and LIABILITY (#4630) * Save activities with type INTEREST, ITEM and LIABILITY * Update changelog --- CHANGELOG.md | 4 ++++ ...eate-or-update-activity-dialog.component.ts | 18 +++++------------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cccc700d..54385109 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Renamed `Order` to `activities` in the `Account` database schema - Improved the language localization for German (`de`) +### Fixed + +- Fixed an issue with the saving of activities with type `INTEREST`, `ITEM` and `LIABILITY` + ## 2.157.1 - 2025-04-29 ### Added 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 f6ce2a81..dce045a4 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 @@ -238,7 +238,7 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { .get('dataSource') .removeValidators(Validators.required); this.activityForm.get('dataSource').updateValueAndValidity(); - this.activityForm.get('fee').reset(); + this.activityForm.get('fee').setValue(0); this.activityForm.get('name').setValidators(Validators.required); this.activityForm.get('name').updateValueAndValidity(); this.activityForm.get('quantity').setValue(1); @@ -248,11 +248,7 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { this.activityForm.get('searchSymbol').updateValueAndValidity(); this.activityForm.get('updateAccountBalance').disable(); this.activityForm.get('updateAccountBalance').setValue(false); - } else if ( - type === 'FEE' || - type === 'INTEREST' || - type === 'LIABILITY' - ) { + } else if (['FEE', 'INTEREST', 'LIABILITY'].includes(type)) { this.activityForm .get('accountId') .removeValidators(Validators.required); @@ -271,12 +267,8 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { .removeValidators(Validators.required); this.activityForm.get('dataSource').updateValueAndValidity(); - if ( - (type === 'FEE' && this.activityForm.get('fee').value === 0) || - type === 'INTEREST' || - type === 'LIABILITY' - ) { - this.activityForm.get('fee').reset(); + if (['INTEREST', 'LIABILITY'].includes(type)) { + this.activityForm.get('fee').setValue(0); } this.activityForm.get('name').setValidators(Validators.required); @@ -284,7 +276,7 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { if (type === 'FEE') { this.activityForm.get('quantity').setValue(0); - } else if (type === 'INTEREST' || type === 'LIABILITY') { + } else if (['INTEREST', 'LIABILITY'].includes(type)) { this.activityForm.get('quantity').setValue(1); } From 2306bc597b7f931a8711ba979ebe1d5f4e7eecea Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Wed, 30 Apr 2025 17:53:42 +0200 Subject: [PATCH 5/5] Release 2.158.0 (#4633) --- CHANGELOG.md | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54385109..4359aa77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## 2.158.0 - 2025-04-30 ### Added diff --git a/package-lock.json b/package-lock.json index 54ce11db..27acd282 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ghostfolio", - "version": "2.157.1", + "version": "2.158.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ghostfolio", - "version": "2.157.1", + "version": "2.158.0", "hasInstallScript": true, "license": "AGPL-3.0", "dependencies": { diff --git a/package.json b/package.json index 42e173d4..c6416388 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ghostfolio", - "version": "2.157.1", + "version": "2.158.0", "homepage": "https://ghostfol.io", "license": "AGPL-3.0", "repository": "https://github.com/ghostfolio/ghostfolio",