From d7abce03dfc34d79d1f7f4f59233e61df31af156 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 5 Jul 2026 18:57:45 +0200 Subject: [PATCH 1/2] Remove deprecated attribute isExcluded from account --- apps/api/src/app/export/export.service.ts | 2 -- apps/api/src/app/import/import.service.ts | 20 ++++++++++++++++-- .../roai/portfolio-calculator-cash.spec.ts | 1 - .../app/portfolio/portfolio.service.spec.ts | 3 --- apps/api/src/helper/account.helper.ts | 1 - .../pages/accounts/accounts-page.component.ts | 3 --- ...eate-or-update-account-dialog.component.ts | 4 ---- .../create-or-update-account-dialog.html | 19 ++++++----------- .../dtos/create-account-with-balances.dto.ts | 10 ++++++++- .../common/src/lib/dtos/create-account.dto.ts | 8 ------- .../common/src/lib/dtos/update-account.dto.ts | 8 ------- libs/common/src/lib/helper.ts | 6 +----- .../accounts-table.component.stories.ts | 3 --- .../activities-table.component.stories.ts | 5 ----- .../migration.sql | 21 +++++++++++++++++++ prisma/schema.prisma | 3 --- 16 files changed, 55 insertions(+), 62 deletions(-) create mode 100644 prisma/migrations/20260705120000_removed_is_excluded_from_account/migration.sql diff --git a/apps/api/src/app/export/export.service.ts b/apps/api/src/app/export/export.service.ts index 8ebfde13d..f820d29b3 100644 --- a/apps/api/src/app/export/export.service.ts +++ b/apps/api/src/app/export/export.service.ts @@ -94,7 +94,6 @@ export class ExportService { comment, currency, id, - isExcluded, name, platform, platformId, @@ -112,7 +111,6 @@ export class ExportService { comment, currency, id, - isExcluded, name, platformId, tags: tags.map(({ id: tagId }) => { diff --git a/apps/api/src/app/import/import.service.ts b/apps/api/src/app/import/import.service.ts index 9b1aa417c..948c478e2 100644 --- a/apps/api/src/app/import/import.service.ts +++ b/apps/api/src/app/import/import.service.ts @@ -9,7 +9,10 @@ import { MarketDataService } from '@ghostfolio/api/services/market-data/market-d import { DataGatheringService } from '@ghostfolio/api/services/queues/data-gathering/data-gathering.service'; import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service'; import { TagService } from '@ghostfolio/api/services/tag/tag.service'; -import { DATA_GATHERING_QUEUE_PRIORITY_HIGH } from '@ghostfolio/common/config'; +import { + DATA_GATHERING_QUEUE_PRIORITY_HIGH, + TAG_ID_EXCLUDE_FROM_ANALYSIS +} from '@ghostfolio/common/config'; import { CreateAssetProfileDto, CreateOrderDto } from '@ghostfolio/common/dtos'; import { getAssetProfileIdentifier, @@ -272,7 +275,11 @@ export class ImportService { // If there is no account or if the account belongs to a different user then create a new account if (!accountWithSameId || accountWithSameId.userId !== user.id) { - const account = omit(accountWithBalances, ['balances', 'tags']); + const account = omit(accountWithBalances, [ + 'balances', + 'isExcluded', + 'tags' + ]); let oldAccountId: string; const platformId = account.platformId; @@ -292,6 +299,15 @@ export class ImportService { return existingTagIds.has(tagId); }); + // Map the legacy isExcluded attribute of old export files to + // the "Exclude from Analysis" tag + if ( + accountWithBalances.isExcluded && + !tagIds.includes(TAG_ID_EXCLUDE_FROM_ANALYSIS) + ) { + tagIds.push(TAG_ID_EXCLUDE_FROM_ANALYSIS); + } + let accountObject: Prisma.AccountCreateInput = { ...account, balances: { diff --git a/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-cash.spec.ts b/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-cash.spec.ts index 7774ee629..771bd7a88 100644 --- a/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-cash.spec.ts +++ b/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-cash.spec.ts @@ -171,7 +171,6 @@ describe('PortfolioCalculator', () => { createdAt: parseDate('2023-12-31'), currency: 'USD', id: accountId, - isExcluded: false, name: 'USD', platformId: null, updatedAt: parseDate('2023-12-31'), diff --git a/apps/api/src/app/portfolio/portfolio.service.spec.ts b/apps/api/src/app/portfolio/portfolio.service.spec.ts index 04142c92b..99834809a 100644 --- a/apps/api/src/app/portfolio/portfolio.service.spec.ts +++ b/apps/api/src/app/portfolio/portfolio.service.spec.ts @@ -185,7 +185,6 @@ describe('PortfolioService', () => { createdAt: parseDate('2024-01-01'), currency: 'USD', id: randomUUID(), - isExcluded: false, name: 'USD', platformId: null, updatedAt: parseDate('2024-01-01'), @@ -219,7 +218,6 @@ describe('PortfolioService', () => { createdAt: parseDate('2024-01-01'), currency: 'USD', id: accountId, - isExcluded: false, name: 'USD', platformId: null, updatedAt: parseDate('2024-01-01'), @@ -351,7 +349,6 @@ describe('PortfolioService', () => { balance: 100, currency: 'USD', id: randomUUID(), - isExcluded: false, name: 'Account 1', platform: { name: 'Platform 1' }, platformId: randomUUID() diff --git a/apps/api/src/helper/account.helper.ts b/apps/api/src/helper/account.helper.ts index 0800c022e..df848b812 100644 --- a/apps/api/src/helper/account.helper.ts +++ b/apps/api/src/helper/account.helper.ts @@ -3,7 +3,6 @@ import { TAG_ID_EXCLUDE_FROM_ANALYSIS } from '@ghostfolio/common/config'; import { Prisma } from '@prisma/client'; export const WHERE_ACCOUNT_NOT_EXCLUDED: Prisma.AccountWhereInput = { - isExcluded: false, tags: { none: { tagId: TAG_ID_EXCLUDE_FROM_ANALYSIS diff --git a/apps/client/src/app/pages/accounts/accounts-page.component.ts b/apps/client/src/app/pages/accounts/accounts-page.component.ts index 907b39d37..1f2ffe401 100644 --- a/apps/client/src/app/pages/accounts/accounts-page.component.ts +++ b/apps/client/src/app/pages/accounts/accounts-page.component.ts @@ -186,7 +186,6 @@ export class GfAccountsPageComponent implements OnInit { comment, currency, id, - isExcluded, name, platformId, tags @@ -201,7 +200,6 @@ export class GfAccountsPageComponent implements OnInit { comment, currency, id, - isExcluded, name, platformId, tags @@ -278,7 +276,6 @@ export class GfAccountsPageComponent implements OnInit { comment: null, currency: this.user?.settings?.baseCurrency ?? null, id: null, - isExcluded: false, name: null, platformId: null, tags: [] diff --git a/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts b/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts index ca88120ca..dec6b57d8 100644 --- a/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts +++ b/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts @@ -27,7 +27,6 @@ import { } from '@angular/forms'; import { MatAutocompleteModule } from '@angular/material/autocomplete'; import { MatButtonModule } from '@angular/material/button'; -import { MatCheckboxModule } from '@angular/material/checkbox'; import { MAT_DIALOG_DATA, MatDialogModule, @@ -51,7 +50,6 @@ import { CreateOrUpdateAccountDialogParams } from './interfaces/interfaces'; GfTagsSelectorComponent, MatAutocompleteModule, MatButtonModule, - MatCheckboxModule, MatDialogModule, MatFormFieldModule, MatInputModule, @@ -105,7 +103,6 @@ export class GfCreateOrUpdateAccountDialogComponent { balance: [this.data.account.balance, Validators.required], comment: [this.data.account.comment], currency: [this.data.account.currency, Validators.required], - isExcluded: [this.data.account.isExcluded], name: [this.data.account.name, Validators.required], platformId: [null, this.autocompleteObjectValidator()], tags: [ @@ -203,7 +200,6 @@ export class GfCreateOrUpdateAccountDialogComponent { comment: this.accountForm.get('comment')?.value || null, currency: this.accountForm.get('currency')?.value, id: this.accountForm.get('accountId')?.value, - isExcluded: this.accountForm.get('isExcluded')?.value, name: this.accountForm.get('name')?.value, platformId: this.accountForm.get('platformId')?.value?.id || null, tags: this.accountForm diff --git a/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.html b/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.html index c707a9402..4e4c62b6f 100644 --- a/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.html +++ b/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.html @@ -85,19 +85,12 @@ > - @if (data.user?.settings?.isExperimentalFeatures) { -