From 02f8f318ba73a54dd3098131af293dc44b570882 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Wed, 17 Sep 2025 07:43:16 +0200 Subject: [PATCH 1/4] Bugfix/add missing guards in isRestrictedView() of permissions (#5540) * Add missing guards --- libs/common/src/lib/permissions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/common/src/lib/permissions.ts b/libs/common/src/lib/permissions.ts index 48ffc95aa..961a74131 100644 --- a/libs/common/src/lib/permissions.ts +++ b/libs/common/src/lib/permissions.ts @@ -197,5 +197,5 @@ export function hasRole(aUser: UserWithSettings, aRole: Role) { } export function isRestrictedView(aUser: UserWithSettings) { - return aUser.settings.settings.isRestrictedView ?? false; + return aUser?.settings?.settings?.isRestrictedView ?? false; } From 07f5f06b7c20625a92e0e922557299d20feceadc Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Wed, 17 Sep 2025 08:21:07 +0200 Subject: [PATCH 2/4] Bugfix/remove data source element in activities table component (#5541) * Clean up * Update changelog --- CHANGELOG.md | 4 ++++ .../src/lib/activities-table/activities-table.component.html | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3ee56750..2eddf30f1 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 - Refactored the show access token dialog component to standalone - Upgraded `prisma` from version `6.15.0` to `6.16.1` +### Fixed + +- Removed a temporary element from the activities table component + ## 2.199.0 - 2025-09-14 ### Added diff --git a/libs/ui/src/lib/activities-table/activities-table.component.html b/libs/ui/src/lib/activities-table/activities-table.component.html index 326440774..85db627d2 100644 --- a/libs/ui/src/lib/activities-table/activities-table.component.html +++ b/libs/ui/src/lib/activities-table/activities-table.component.html @@ -129,7 +129,6 @@ [symbol]="element.SymbolProfile?.symbol" [tooltip]="element.SymbolProfile?.name" /> -
{{ element.dataSource }}
From 40f5c93f43dc32cc00d496b692de7fc8135664df Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Wed, 17 Sep 2025 19:55:05 +0200 Subject: [PATCH 3/4] Feature/set up asset profile resolution database table (#5533) * Set up asset profile resolution database table --- .../ghostfolio/ghostfolio.service.ts | 29 +++++++++++++++++-- .../src/app/pages/api/api-page.component.ts | 12 ++++++++ apps/client/src/app/pages/api/api-page.html | 4 +++ .../migration.sql | 17 +++++++++++ prisma/schema.prisma | 14 +++++++++ 5 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 prisma/migrations/20250915163323_added_asset_profile_resolution/migration.sql diff --git a/apps/api/src/app/endpoints/data-providers/ghostfolio/ghostfolio.service.ts b/apps/api/src/app/endpoints/data-providers/ghostfolio/ghostfolio.service.ts index f80633f87..cc92efa02 100644 --- a/apps/api/src/app/endpoints/data-providers/ghostfolio/ghostfolio.service.ts +++ b/apps/api/src/app/endpoints/data-providers/ghostfolio/ghostfolio.service.ts @@ -56,11 +56,36 @@ export class GhostfolioService { requestTimeout, symbol }) - .then((assetProfile) => { + .then(async (assetProfile) => { + const dataSourceOrigin = DataSource.GHOSTFOLIO; + + if (assetProfile) { + await this.prismaService.assetProfileResolution.upsert({ + create: { + dataSourceOrigin, + currency: assetProfile.currency, + dataSourceTarget: assetProfile.dataSource, + symbolOrigin: symbol, + symbolTarget: assetProfile.symbol + }, + update: { + requestCount: { + increment: 1 + } + }, + where: { + dataSourceOrigin_symbolOrigin: { + dataSourceOrigin, + symbolOrigin: symbol + } + } + }); + } + result = { ...result, ...assetProfile, - dataSource: DataSource.GHOSTFOLIO + dataSource: dataSourceOrigin }; return assetProfile; diff --git a/apps/client/src/app/pages/api/api-page.component.ts b/apps/client/src/app/pages/api/api-page.component.ts index 87fc164af..353605380 100644 --- a/apps/client/src/app/pages/api/api-page.component.ts +++ b/apps/client/src/app/pages/api/api-page.component.ts @@ -4,6 +4,7 @@ import { } from '@ghostfolio/common/config'; import { DATE_FORMAT } from '@ghostfolio/common/helper'; import { + DataProviderGhostfolioAssetProfileResponse, DataProviderGhostfolioStatusResponse, DividendsResponse, HistoricalResponse, @@ -25,6 +26,7 @@ import { map, Observable, Subject, takeUntil } from 'rxjs'; templateUrl: './api-page.html' }) export class GfApiPageComponent implements OnInit { + public assetProfile$: Observable; public dividends$: Observable; public historicalData$: Observable; public isinLookupItems$: Observable; @@ -40,6 +42,7 @@ export class GfApiPageComponent implements OnInit { public ngOnInit() { this.apiKey = prompt($localize`Please enter your Ghostfolio API key:`); + this.assetProfile$ = this.fetchAssetProfile({ symbol: 'AAPL' }); this.dividends$ = this.fetchDividends({ symbol: 'KO' }); this.historicalData$ = this.fetchHistoricalData({ symbol: 'AAPL' }); this.isinLookupItems$ = this.fetchLookupItems({ query: 'US0378331005' }); @@ -53,6 +56,15 @@ export class GfApiPageComponent implements OnInit { this.unsubscribeSubject.complete(); } + private fetchAssetProfile({ symbol }: { symbol: string }) { + return this.http + .get( + `/api/v1/data-providers/ghostfolio/asset-profile/${symbol}`, + { headers: this.getHeaders() } + ) + .pipe(takeUntil(this.unsubscribeSubject)); + } + private fetchDividends({ symbol }: { symbol: string }) { const params = new HttpParams() .set('from', format(startOfYear(new Date()), DATE_FORMAT)) diff --git a/apps/client/src/app/pages/api/api-page.html b/apps/client/src/app/pages/api/api-page.html index d8bfc75d7..3c43484e6 100644 --- a/apps/client/src/app/pages/api/api-page.html +++ b/apps/client/src/app/pages/api/api-page.html @@ -3,6 +3,10 @@

Status

{{ status$ | async | json }}
+
+

Asset Profile

+
{{ assetProfile$ | async | json }}
+

Lookup

@if (lookupItems$) { diff --git a/prisma/migrations/20250915163323_added_asset_profile_resolution/migration.sql b/prisma/migrations/20250915163323_added_asset_profile_resolution/migration.sql new file mode 100644 index 000000000..947c1f186 --- /dev/null +++ b/prisma/migrations/20250915163323_added_asset_profile_resolution/migration.sql @@ -0,0 +1,17 @@ +-- CreateTable +CREATE TABLE "public"."AssetProfileResolution" ( + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "currency" TEXT NOT NULL, + "dataSourceOrigin" "public"."DataSource" NOT NULL, + "dataSourceTarget" "public"."DataSource" NOT NULL, + "id" TEXT NOT NULL, + "requestCount" INTEGER NOT NULL DEFAULT 1, + "symbolOrigin" TEXT NOT NULL, + "symbolTarget" TEXT NOT NULL, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "AssetProfileResolution_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE UNIQUE INDEX "AssetProfileResolution_dataSourceOrigin_symbolOrigin_key" ON "public"."AssetProfileResolution"("dataSourceOrigin", "symbolOrigin"); diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 609bede5c..67ca81682 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -88,6 +88,20 @@ model ApiKey { @@index([userId]) } +model AssetProfileResolution { + createdAt DateTime @default(now()) + currency String + dataSourceOrigin DataSource + dataSourceTarget DataSource + id String @id @default(uuid()) + requestCount Int @default(1) + symbolOrigin String + symbolTarget String + updatedAt DateTime @updatedAt + + @@unique([dataSourceOrigin, symbolOrigin]) +} + model AuthDevice { createdAt DateTime @default(now()) credentialId Bytes From 2835c813fa8fdc217fef00bd2e87eedcf19ae7f7 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Wed, 17 Sep 2025 19:59:49 +0200 Subject: [PATCH 4/4] Release 2.200.0 (#5542) --- 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 2eddf30f1..5fbf7c05b 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.200.0 - 2025-09-17 ### Changed diff --git a/package-lock.json b/package-lock.json index f6b15e6a7..64a90002a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ghostfolio", - "version": "2.199.0", + "version": "2.200.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ghostfolio", - "version": "2.199.0", + "version": "2.200.0", "hasInstallScript": true, "license": "AGPL-3.0", "dependencies": { diff --git a/package.json b/package.json index 26232140a..7ede9549d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ghostfolio", - "version": "2.199.0", + "version": "2.200.0", "homepage": "https://ghostfol.io", "license": "AGPL-3.0", "repository": "https://github.com/ghostfolio/ghostfolio",