From 37ab31ea722624f0e55c3df417424f3dc9981054 Mon Sep 17 00:00:00 2001 From: danielochinasa Date: Thu, 23 Oct 2025 16:58:14 +0100 Subject: [PATCH 1/3] Task/format value in Buying Power rule (#5824) * Format value in Buying Power rule * Update changelog --- CHANGELOG.md | 1 + apps/api/src/models/rules/liquidity/buying-power.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 285e8917a..70dc9ae17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Localized the number formatting in the static portfolio analysis rule: _Liquidity_ (Buying Power) - Upgraded `prisma` from version `6.17.1` to `6.18.0` ## 2.210.1 - 2025-10-22 diff --git a/apps/api/src/models/rules/liquidity/buying-power.ts b/apps/api/src/models/rules/liquidity/buying-power.ts index 70393278d..2cd4d6fee 100644 --- a/apps/api/src/models/rules/liquidity/buying-power.ts +++ b/apps/api/src/models/rules/liquidity/buying-power.ts @@ -40,7 +40,9 @@ export class BuyingPower extends Rule { languageCode: this.getLanguageCode(), placeholders: { baseCurrency: ruleSettings.baseCurrency, - thresholdMin: ruleSettings.thresholdMin + thresholdMin: ruleSettings.thresholdMin.toLocaleString( + ruleSettings.locale + ) } }), value: false @@ -53,7 +55,9 @@ export class BuyingPower extends Rule { languageCode: this.getLanguageCode(), placeholders: { baseCurrency: ruleSettings.baseCurrency, - thresholdMin: ruleSettings.thresholdMin + thresholdMin: ruleSettings.thresholdMin.toLocaleString( + ruleSettings.locale + ) } }), value: true From 852ed98d0fbd5e13541dd75e5afbf155f8d893ad Mon Sep 17 00:00:00 2001 From: Harsh Santwani <96873014+HydrallHarsh@users.noreply.github.com> Date: Thu, 23 Oct 2025 23:32:59 +0530 Subject: [PATCH 2/3] Task/move prisma.config.ts to .config/prisma.ts (#5821) * Move prisma.config.ts to .config/prisma.ts * Update changelog --- .config/prisma.ts | 14 ++++++++++++++ CHANGELOG.md | 1 + Dockerfile | 4 ++-- apps/api/src/dependencies.ts | 2 +- prisma.config.ts | 14 -------------- 5 files changed, 18 insertions(+), 17 deletions(-) create mode 100644 .config/prisma.ts delete mode 100644 prisma.config.ts diff --git a/.config/prisma.ts b/.config/prisma.ts new file mode 100644 index 000000000..64691136c --- /dev/null +++ b/.config/prisma.ts @@ -0,0 +1,14 @@ +import { defineConfig } from '@prisma/config'; +import { config } from 'dotenv'; +import { expand } from 'dotenv-expand'; +import { join } from 'node:path'; + +expand(config({ quiet: true })); + +export default defineConfig({ + migrations: { + path: join(__dirname, '..', 'prisma', 'migrations'), + seed: `node ${join(__dirname, '..', 'prisma', 'seed.mts')}` + }, + schema: join(__dirname, '..', 'prisma', 'schema.prisma') +}); diff --git a/CHANGELOG.md b/CHANGELOG.md index 70dc9ae17..d46c1d3c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Localized the number formatting in the static portfolio analysis rule: _Liquidity_ (Buying Power) +- Moved the _Prisma Configuration File_ from `prisma.config.ts` to `.config/prisma.ts` - Upgraded `prisma` from version `6.17.1` to `6.18.0` ## 2.210.1 - 2025-10-22 diff --git a/Dockerfile b/Dockerfile index be1bb53ea..5beaf6e03 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,11 +13,11 @@ RUN apt-get update && apt-get install -y --no-install-suggests \ # Only add basic files without the application itself to avoid rebuilding # layers when files (package.json etc.) have not changed +COPY ./.config .config/ COPY ./CHANGELOG.md CHANGELOG.md COPY ./LICENSE LICENSE COPY ./package.json package.json COPY ./package-lock.json package-lock.json -COPY ./prisma.config.ts prisma.config.ts COPY ./prisma/schema.prisma prisma/ RUN npm install @@ -44,7 +44,7 @@ WORKDIR /ghostfolio/dist/apps/api COPY ./package-lock.json /ghostfolio/dist/apps/api/ RUN npm install -COPY prisma.config.ts /ghostfolio/dist/apps/api/ +COPY .config /ghostfolio/dist/apps/api/.config/ COPY prisma /ghostfolio/dist/apps/api/prisma/ # Overwrite the generated package.json with the original one to ensure having diff --git a/apps/api/src/dependencies.ts b/apps/api/src/dependencies.ts index cd5409fd4..acb7af382 100644 --- a/apps/api/src/dependencies.ts +++ b/apps/api/src/dependencies.ts @@ -1,3 +1,3 @@ -// Dependencies required by prisma.config.ts in Docker container +// Dependencies required by .config/prisma.ts in Docker container import 'dotenv'; import 'dotenv-expand'; diff --git a/prisma.config.ts b/prisma.config.ts deleted file mode 100644 index 60597cbf1..000000000 --- a/prisma.config.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { config } from 'dotenv'; -import { expand } from 'dotenv-expand'; -import { join } from 'node:path'; -import { defineConfig } from 'prisma/config'; - -expand(config({ quiet: true })); - -export default defineConfig({ - migrations: { - path: join('prisma', 'migrations'), - seed: `node ${join('prisma', 'seed.mts')}` - }, - schema: join('prisma', 'schema.prisma') -}); From 0b28da879b234bc8bb4c360857fc340e67e9339b Mon Sep 17 00:00:00 2001 From: Vansh <140736931+Vansh-Parate@users.noreply.github.com> Date: Thu, 23 Oct 2025 23:49:59 +0530 Subject: [PATCH 3/3] Task/extend export response by performanceCalculationType (#5816) * Extend export response by performanceCalculationType * Update changelog --- CHANGELOG.md | 4 ++++ apps/api/src/app/export/export.controller.ts | 4 ++-- apps/api/src/app/export/export.service.ts | 19 +++++++++++++------ .../responses/export-response.interface.ts | 8 +++++++- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d46c1d3c1..c249cd7d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Added + +- Extended the export functionality by the user account’s performance calculation type + ### Changed - Localized the number formatting in the static portfolio analysis rule: _Liquidity_ (Buying Power) diff --git a/apps/api/src/app/export/export.controller.ts b/apps/api/src/app/export/export.controller.ts index 0b4a2c6e0..5446f8789 100644 --- a/apps/api/src/app/export/export.controller.ts +++ b/apps/api/src/app/export/export.controller.ts @@ -48,8 +48,8 @@ export class ExportController { return this.exportService.export({ activityIds, filters, - userCurrency: this.request.user.settings.settings.baseCurrency, - userId: this.request.user.id + userId: this.request.user.id, + userSettings: this.request.user.settings.settings }); } } diff --git a/apps/api/src/app/export/export.service.ts b/apps/api/src/app/export/export.service.ts index 2001fd3e2..d07b199be 100644 --- a/apps/api/src/app/export/export.service.ts +++ b/apps/api/src/app/export/export.service.ts @@ -3,7 +3,11 @@ import { OrderService } from '@ghostfolio/api/app/order/order.service'; import { environment } from '@ghostfolio/api/environments/environment'; import { MarketDataService } from '@ghostfolio/api/services/market-data/market-data.service'; import { TagService } from '@ghostfolio/api/services/tag/tag.service'; -import { ExportResponse, Filter } from '@ghostfolio/common/interfaces'; +import { + ExportResponse, + Filter, + UserSettings +} from '@ghostfolio/common/interfaces'; import { Injectable } from '@nestjs/common'; import { Platform, Prisma } from '@prisma/client'; @@ -21,13 +25,13 @@ export class ExportService { public async export({ activityIds, filters, - userCurrency, - userId + userId, + userSettings }: { activityIds?: string[]; filters?: Filter[]; - userCurrency: string; userId: string; + userSettings: UserSettings; }): Promise { const { ACCOUNT: filtersByAccount } = groupBy(filters, ({ type }) => { return type; @@ -36,11 +40,11 @@ export class ExportService { let { activities } = await this.orderService.getOrders({ filters, - userCurrency, userId, includeDrafts: true, sortColumn: 'date', sortDirection: 'asc', + userCurrency: userSettings?.baseCurrency, withExcludedAccountsAndActivities: true }); @@ -244,7 +248,10 @@ export class ExportService { } ), user: { - settings: { currency: userCurrency } + settings: { + currency: userSettings?.baseCurrency, + performanceCalculationType: userSettings?.performanceCalculationType + } } }; } diff --git a/libs/common/src/lib/interfaces/responses/export-response.interface.ts b/libs/common/src/lib/interfaces/responses/export-response.interface.ts index a5416e886..8b1697ca4 100644 --- a/libs/common/src/lib/interfaces/responses/export-response.interface.ts +++ b/libs/common/src/lib/interfaces/responses/export-response.interface.ts @@ -9,6 +9,7 @@ import { import { AccountBalance } from '../account-balance.interface'; import { MarketData } from '../market-data.interface'; +import { UserSettings } from '../user-settings.interface'; export interface ExportResponse { accounts: (Omit & { @@ -36,5 +37,10 @@ export interface ExportResponse { }; platforms: Platform[]; tags: Omit[]; - user: { settings: { currency: string } }; + user: { + settings: { + currency: UserSettings['baseCurrency']; + performanceCalculationType: UserSettings['performanceCalculationType']; + }; + }; }