Date Range
@@ -96,7 +96,7 @@
(selectionChange)="onChangeDateRange($event.value)"
>
@for (range of dateRangeOptions; track range) {
- {{ range.label }}
+ {{ range.label }}
}
@@ -108,16 +108,16 @@
@for (account of accounts; track account.id) {
-
-
- {{ account.name }}
-
-
+
+
+ {{ account.name }}
+
+
}
@@ -128,7 +128,7 @@
@for (tag of tags; track tag.id) {
- {{ tag.label }}
+ {{ tag.label }}
}
@@ -139,9 +139,9 @@
@for (assetClass of assetClasses; track assetClass.id) {
- {{ assetClass.label }}
+ {{
+ assetClass.label
+ }}
}
From 48b412cfb80ea1e78d2d35c4172ef021d8131b35 Mon Sep 17 00:00:00 2001
From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com>
Date: Thu, 22 Feb 2024 20:10:27 +0100
Subject: [PATCH 16/56] Feature/harmonize setting of default locale (#3032)
* Harmonize setting of default locale
* Update changelog
---
CHANGELOG.md | 1 +
.../accounts-table/accounts-table.component.ts | 4 +++-
.../benchmark-comparator.component.ts | 3 ++-
.../investment-chart/investment-chart.component.ts | 3 ++-
.../portfolio-performance.component.ts | 3 ++-
.../portfolio-summary.component.ts | 4 ++--
.../app/components/position/position.component.ts | 3 ++-
.../app/components/positions/positions.component.ts | 3 ++-
.../world-map-chart/world-map-chart.component.ts | 4 ++--
libs/common/src/lib/chart-helper.ts | 3 ++-
libs/common/src/lib/helper.ts | 6 ++----
.../account-balances/account-balances.component.ts | 3 ++-
.../activities-table/activities-table.component.ts | 4 ++--
libs/ui/src/lib/benchmark/benchmark.component.ts | 4 ++--
.../fire-calculator/fire-calculator.component.ts | 3 ++-
.../lib/holdings-table/holdings-table.component.ts | 3 ++-
libs/ui/src/lib/line-chart/line-chart.component.ts | 13 +++----------
.../portfolio-proportion-chart.component.ts | 4 ++--
libs/ui/src/lib/value/value.component.ts | 7 +------
19 files changed, 38 insertions(+), 40 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4c04d45cc..968e05d21 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
+- Harmonized the setting of a default locale in various components
- Set the parser to `angular` in the `prettier` options
## 2.54.0 - 2024-02-19
diff --git a/apps/client/src/app/components/accounts-table/accounts-table.component.ts b/apps/client/src/app/components/accounts-table/accounts-table.component.ts
index d7c948adf..702803aa0 100644
--- a/apps/client/src/app/components/accounts-table/accounts-table.component.ts
+++ b/apps/client/src/app/components/accounts-table/accounts-table.component.ts
@@ -1,3 +1,5 @@
+import { getLocale } from '@ghostfolio/common/helper';
+
import {
ChangeDetectionStrategy,
Component,
@@ -27,7 +29,7 @@ export class AccountsTableComponent implements OnChanges, OnDestroy, OnInit {
@Input() baseCurrency: string;
@Input() deviceType: string;
@Input() hasPermissionToOpenDetails = true;
- @Input() locale: string;
+ @Input() locale = getLocale();
@Input() showActions: boolean;
@Input() showBalance = true;
@Input() showFooter = true;
diff --git a/apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.ts b/apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.ts
index 646a45e85..8a9c8f8dd 100644
--- a/apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.ts
+++ b/apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.ts
@@ -7,6 +7,7 @@ import { primaryColorRgb, secondaryColorRgb } from '@ghostfolio/common/config';
import {
getBackgroundColor,
getDateFormatString,
+ getLocale,
getTextColor,
parseDate
} from '@ghostfolio/common/helper';
@@ -51,7 +52,7 @@ export class BenchmarkComparatorComponent implements OnChanges, OnDestroy {
@Input() colorScheme: ColorScheme;
@Input() daysInMarket: number;
@Input() isLoading: boolean;
- @Input() locale: string;
+ @Input() locale = getLocale();
@Input() performanceDataItems: LineChartItem[];
@Input() user: User;
diff --git a/apps/client/src/app/components/investment-chart/investment-chart.component.ts b/apps/client/src/app/components/investment-chart/investment-chart.component.ts
index b8fa4663f..56de9d438 100644
--- a/apps/client/src/app/components/investment-chart/investment-chart.component.ts
+++ b/apps/client/src/app/components/investment-chart/investment-chart.component.ts
@@ -9,6 +9,7 @@ import {
DATE_FORMAT,
getBackgroundColor,
getDateFormatString,
+ getLocale,
getTextColor,
parseDate
} from '@ghostfolio/common/helper';
@@ -65,7 +66,7 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy {
@Input() historicalDataItems: LineChartItem[] = [];
@Input() isInPercent = false;
@Input() isLoading = false;
- @Input() locale: string;
+ @Input() locale = getLocale();
@Input() range: DateRange = 'max';
@Input() savingsRate = 0;
diff --git a/apps/client/src/app/components/portfolio-performance/portfolio-performance.component.ts b/apps/client/src/app/components/portfolio-performance/portfolio-performance.component.ts
index 2705ca1f1..720adb3f6 100644
--- a/apps/client/src/app/components/portfolio-performance/portfolio-performance.component.ts
+++ b/apps/client/src/app/components/portfolio-performance/portfolio-performance.component.ts
@@ -1,4 +1,5 @@
import {
+ getLocale,
getNumberFormatDecimal,
getNumberFormatGroup
} from '@ghostfolio/common/helper';
@@ -31,7 +32,7 @@ export class PortfolioPerformanceComponent implements OnChanges, OnInit {
@Input() isAllTimeHigh: boolean;
@Input() isAllTimeLow: boolean;
@Input() isLoading: boolean;
- @Input() locale: string;
+ @Input() locale = getLocale();
@Input() performance: PortfolioPerformance;
@Input() showDetails: boolean;
@Input() unit: string;
diff --git a/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts b/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts
index dd91892b2..9ceae5186 100644
--- a/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts
+++ b/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts
@@ -1,4 +1,4 @@
-import { getDateFnsLocale } from '@ghostfolio/common/helper';
+import { getDateFnsLocale, getLocale } from '@ghostfolio/common/helper';
import { PortfolioSummary } from '@ghostfolio/common/interfaces';
import {
@@ -23,7 +23,7 @@ export class PortfolioSummaryComponent implements OnChanges, OnInit {
@Input() hasPermissionToUpdateUserSettings: boolean;
@Input() isLoading: boolean;
@Input() language: string;
- @Input() locale: string;
+ @Input() locale = getLocale();
@Input() summary: PortfolioSummary;
@Output() emergencyFundChanged = new EventEmitter
();
diff --git a/apps/client/src/app/components/position/position.component.ts b/apps/client/src/app/components/position/position.component.ts
index 3feac5d8e..3a5fbae81 100644
--- a/apps/client/src/app/components/position/position.component.ts
+++ b/apps/client/src/app/components/position/position.component.ts
@@ -1,4 +1,5 @@
import { UNKNOWN_KEY } from '@ghostfolio/common/config';
+import { getLocale } from '@ghostfolio/common/helper';
import { Position } from '@ghostfolio/common/interfaces';
import {
@@ -20,7 +21,7 @@ export class PositionComponent implements OnDestroy, OnInit {
@Input() baseCurrency: string;
@Input() deviceType: string;
@Input() isLoading: boolean;
- @Input() locale: string;
+ @Input() locale = getLocale();
@Input() position: Position;
@Input() range: string;
diff --git a/apps/client/src/app/components/positions/positions.component.ts b/apps/client/src/app/components/positions/positions.component.ts
index 8b84d7e8b..ab9812462 100644
--- a/apps/client/src/app/components/positions/positions.component.ts
+++ b/apps/client/src/app/components/positions/positions.component.ts
@@ -1,3 +1,4 @@
+import { getLocale } from '@ghostfolio/common/helper';
import { Position } from '@ghostfolio/common/interfaces';
import {
@@ -18,7 +19,7 @@ export class PositionsComponent implements OnChanges, OnInit {
@Input() baseCurrency: string;
@Input() deviceType: string;
@Input() hasPermissionToCreateOrder: boolean;
- @Input() locale: string;
+ @Input() locale = getLocale();
@Input() positions: Position[];
@Input() range: string;
diff --git a/apps/client/src/app/components/world-map-chart/world-map-chart.component.ts b/apps/client/src/app/components/world-map-chart/world-map-chart.component.ts
index 32375d7d2..04472c3fe 100644
--- a/apps/client/src/app/components/world-map-chart/world-map-chart.component.ts
+++ b/apps/client/src/app/components/world-map-chart/world-map-chart.component.ts
@@ -1,4 +1,4 @@
-import { getNumberFormatGroup } from '@ghostfolio/common/helper';
+import { getLocale, getNumberFormatGroup } from '@ghostfolio/common/helper';
import {
ChangeDetectionStrategy,
@@ -21,7 +21,7 @@ export class WorldMapChartComponent implements OnChanges, OnDestroy, OnInit {
@Input() countries: { [code: string]: { name?: string; value: number } };
@Input() format: string;
@Input() isInPercent = false;
- @Input() locale: string;
+ @Input() locale = getLocale();
public isLoading = true;
public svgMapElement;
diff --git a/libs/common/src/lib/chart-helper.ts b/libs/common/src/lib/chart-helper.ts
index d4a5d75d9..5b65d4a87 100644
--- a/libs/common/src/lib/chart-helper.ts
+++ b/libs/common/src/lib/chart-helper.ts
@@ -6,6 +6,7 @@ import {
DATE_FORMAT_MONTHLY,
DATE_FORMAT_YEARLY,
getBackgroundColor,
+ getLocale,
getTextColor
} from './helper';
import { ColorScheme, GroupBy } from './types';
@@ -30,7 +31,7 @@ export function getTooltipOptions({
colorScheme,
currency = '',
groupBy,
- locale = '',
+ locale = getLocale(),
unit = ''
}: {
colorScheme?: ColorScheme;
diff --git a/libs/common/src/lib/helper.ts b/libs/common/src/lib/helper.ts
index 6afecc398..c6a15e22e 100644
--- a/libs/common/src/lib/helper.ts
+++ b/libs/common/src/lib/helper.ts
@@ -217,9 +217,7 @@ export function getEmojiFlag(aCountryCode: string) {
}
export function getLocale() {
- return navigator.languages?.length
- ? navigator.languages[0]
- : navigator.language ?? locale;
+ return navigator.language ?? locale;
}
export function getNumberFormatDecimal(aLocale?: string) {
@@ -230,7 +228,7 @@ export function getNumberFormatDecimal(aLocale?: string) {
}).value;
}
-export function getNumberFormatGroup(aLocale?: string) {
+export function getNumberFormatGroup(aLocale = getLocale()) {
const formatObject = new Intl.NumberFormat(aLocale).formatToParts(9999.99);
return formatObject.find((object) => {
diff --git a/libs/ui/src/lib/account-balances/account-balances.component.ts b/libs/ui/src/lib/account-balances/account-balances.component.ts
index c4d808aaf..65f2547b9 100644
--- a/libs/ui/src/lib/account-balances/account-balances.component.ts
+++ b/libs/ui/src/lib/account-balances/account-balances.component.ts
@@ -1,3 +1,4 @@
+import { getLocale } from '@ghostfolio/common/helper';
import { AccountBalancesResponse } from '@ghostfolio/common/interfaces';
import {
@@ -25,7 +26,7 @@ import { Subject } from 'rxjs';
export class AccountBalancesComponent implements OnChanges, OnDestroy, OnInit {
@Input() accountBalances: AccountBalancesResponse['balances'];
@Input() accountId: string;
- @Input() locale: string;
+ @Input() locale = getLocale();
@Input() showActions = true;
@Output() accountBalanceDeleted = new EventEmitter();
diff --git a/libs/ui/src/lib/activities-table/activities-table.component.ts b/libs/ui/src/lib/activities-table/activities-table.component.ts
index bfa50a16d..af42f86e4 100644
--- a/libs/ui/src/lib/activities-table/activities-table.component.ts
+++ b/libs/ui/src/lib/activities-table/activities-table.component.ts
@@ -1,6 +1,6 @@
import { Activity } from '@ghostfolio/api/app/order/interfaces/activities.interface';
import { DEFAULT_PAGE_SIZE } from '@ghostfolio/common/config';
-import { getDateFormatString } from '@ghostfolio/common/helper';
+import { getDateFormatString, getLocale } from '@ghostfolio/common/helper';
import { UniqueAsset } from '@ghostfolio/common/interfaces';
import { OrderWithAccount } from '@ghostfolio/common/types';
@@ -40,7 +40,7 @@ export class ActivitiesTableComponent
@Input() hasPermissionToCreateActivity: boolean;
@Input() hasPermissionToExportActivities: boolean;
@Input() hasPermissionToOpenDetails = true;
- @Input() locale: string;
+ @Input() locale = getLocale();
@Input() pageIndex: number;
@Input() pageSize = DEFAULT_PAGE_SIZE;
@Input() showActions = true;
diff --git a/libs/ui/src/lib/benchmark/benchmark.component.ts b/libs/ui/src/lib/benchmark/benchmark.component.ts
index 69c939d31..5509886af 100644
--- a/libs/ui/src/lib/benchmark/benchmark.component.ts
+++ b/libs/ui/src/lib/benchmark/benchmark.component.ts
@@ -1,4 +1,4 @@
-import { resolveMarketCondition } from '@ghostfolio/common/helper';
+import { getLocale, resolveMarketCondition } from '@ghostfolio/common/helper';
import { Benchmark, User } from '@ghostfolio/common/interfaces';
import {
@@ -16,7 +16,7 @@ import {
})
export class BenchmarkComponent implements OnChanges {
@Input() benchmarks: Benchmark[];
- @Input() locale: string;
+ @Input() locale = getLocale();
@Input() user: User;
public displayedColumns = ['name', 'date', 'change', 'marketCondition'];
diff --git a/libs/ui/src/lib/fire-calculator/fire-calculator.component.ts b/libs/ui/src/lib/fire-calculator/fire-calculator.component.ts
index 18ff05fb4..60c47a309 100644
--- a/libs/ui/src/lib/fire-calculator/fire-calculator.component.ts
+++ b/libs/ui/src/lib/fire-calculator/fire-calculator.component.ts
@@ -3,6 +3,7 @@ import {
transformTickToAbbreviation
} from '@ghostfolio/common/chart-helper';
import { primaryColorRgb } from '@ghostfolio/common/config';
+import { getLocale } from '@ghostfolio/common/helper';
import { ColorScheme } from '@ghostfolio/common/types';
import {
@@ -55,7 +56,7 @@ export class FireCalculatorComponent implements OnChanges, OnDestroy {
@Input() deviceType: string;
@Input() fireWealth: number;
@Input() hasPermissionToUpdateUserSettings: boolean;
- @Input() locale: string;
+ @Input() locale = getLocale();
@Input() projectedTotalAmount = 0;
@Input() retirementDate: Date;
@Input() savingsRate = 0;
diff --git a/libs/ui/src/lib/holdings-table/holdings-table.component.ts b/libs/ui/src/lib/holdings-table/holdings-table.component.ts
index 7c965f7d7..38403d519 100644
--- a/libs/ui/src/lib/holdings-table/holdings-table.component.ts
+++ b/libs/ui/src/lib/holdings-table/holdings-table.component.ts
@@ -1,3 +1,4 @@
+import { getLocale } from '@ghostfolio/common/helper';
import { PortfolioPosition, UniqueAsset } from '@ghostfolio/common/interfaces';
import {
@@ -29,7 +30,7 @@ export class HoldingsTableComponent implements OnChanges, OnDestroy, OnInit {
@Input() hasPermissionToOpenDetails = true;
@Input() hasPermissionToShowValues = true;
@Input() holdings: PortfolioPosition[];
- @Input() locale: string;
+ @Input() locale = getLocale();
@Input() pageSize = Number.MAX_SAFE_INTEGER;
@ViewChild(MatPaginator) paginator: MatPaginator;
diff --git a/libs/ui/src/lib/line-chart/line-chart.component.ts b/libs/ui/src/lib/line-chart/line-chart.component.ts
index 56de11a64..bad5e2f3f 100644
--- a/libs/ui/src/lib/line-chart/line-chart.component.ts
+++ b/libs/ui/src/lib/line-chart/line-chart.component.ts
@@ -3,14 +3,11 @@ import {
getTooltipPositionerMapTop,
getVerticalHoverLinePlugin
} from '@ghostfolio/common/chart-helper';
-import {
- locale,
- primaryColorRgb,
- secondaryColorRgb
-} from '@ghostfolio/common/config';
+import { primaryColorRgb, secondaryColorRgb } from '@ghostfolio/common/config';
import {
getBackgroundColor,
getDateFormatString,
+ getLocale,
getTextColor
} from '@ghostfolio/common/helper';
import { LineChartItem } from '@ghostfolio/common/interfaces';
@@ -51,7 +48,7 @@ export class LineChartComponent implements AfterViewInit, OnChanges, OnDestroy {
@Input() currency: string;
@Input() historicalDataItems: LineChartItem[];
@Input() isAnimated = false;
- @Input() locale: string;
+ @Input() locale = getLocale();
@Input() showGradient = false;
@Input() showLegend = false;
@Input() showLoader = true;
@@ -106,10 +103,6 @@ export class LineChartComponent implements AfterViewInit, OnChanges, OnDestroy {
this.changeDetectorRef.markForCheck();
});
}
-
- if (!this.locale) {
- this.locale = locale;
- }
}
public ngOnDestroy() {
diff --git a/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts b/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts
index e9d3f11a2..faecbeca6 100644
--- a/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts
+++ b/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts
@@ -1,6 +1,6 @@
import { getTooltipOptions } from '@ghostfolio/common/chart-helper';
import { UNKNOWN_KEY } from '@ghostfolio/common/config';
-import { getTextColor } from '@ghostfolio/common/helper';
+import { getLocale, getTextColor } from '@ghostfolio/common/helper';
import { PortfolioPosition, UniqueAsset } from '@ghostfolio/common/interfaces';
import { ColorScheme } from '@ghostfolio/common/types';
import { translate } from '@ghostfolio/ui/i18n';
@@ -41,7 +41,7 @@ export class PortfolioProportionChartComponent
@Input() cursor: string;
@Input() isInPercent = false;
@Input() keys: string[] = [];
- @Input() locale = '';
+ @Input() locale = getLocale();
@Input() maxItems?: number;
@Input() showLabels = false;
@Input() positions: {
diff --git a/libs/ui/src/lib/value/value.component.ts b/libs/ui/src/lib/value/value.component.ts
index eb1536aa0..13675403f 100644
--- a/libs/ui/src/lib/value/value.component.ts
+++ b/libs/ui/src/lib/value/value.component.ts
@@ -21,7 +21,7 @@ export class ValueComponent implements OnChanges {
@Input() isCurrency = false;
@Input() isDate = false;
@Input() isPercent = false;
- @Input() locale: string | undefined;
+ @Input() locale = getLocale();
@Input() position = '';
@Input() precision: number | undefined;
@Input() size: 'large' | 'medium' | 'small' = 'small';
@@ -129,11 +129,6 @@ export class ValueComponent implements OnChanges {
this.formattedValue = '';
this.isNumber = false;
this.isString = false;
-
- if (!this.locale) {
- this.locale = getLocale();
- }
-
this.useAbsoluteValue = false;
}
}
From 07eabac0596456b35c85c79bbac4b9d5352166d2 Mon Sep 17 00:00:00 2001
From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com>
Date: Thu, 22 Feb 2024 20:21:50 +0100
Subject: [PATCH 17/56] Feature/add missing database indexes part 2 (#3033)
* Add missing database indexes (for orderBy and where clauses)
* Update changelog
---
CHANGELOG.md | 14 +++
apps/api/src/app/account/account.service.ts | 4 +-
apps/api/src/app/user/user.service.ts | 2 +-
package.json | 2 +-
.../migration.sql | 86 +++++++++++++++++++
prisma/schema.prisma | 37 ++++++++
6 files changed, 140 insertions(+), 5 deletions(-)
create mode 100644 prisma/migrations/20240221201438_added_missing_indexes/migration.sql
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 968e05d21..b9648e42a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
+### Added
+
+- Added indexes for `alias`, `granteeUserId` and `userId` to the access database table
+- Added indexes for `currency`, `name` and `userId` to the account database table
+- Added an index for `accountId`, `date` and `updatedAt` to the account balance database table
+- Added an index for `userId` to the auth device database table
+- Added an index for `marketPrice` and `state` to the market data database table
+- Added indexes for `date`, `isDraft` and `userId` to the order database table
+- Added an index for `name` to the platform database table
+- Added indexes for `assetClass`, `currency`, `dataSource`, `isin`, `name` and `symbol` to the symbol profile database table
+- Added an index for `userId` to the subscription database table
+- Added an index for `name` to the tag database table
+- Added indexes for `accessToken`, `createdAt`, `provider`, `role` and `thirdPartyId` to the user database table
+
### Changed
- Harmonized the setting of a default locale in various components
diff --git a/apps/api/src/app/account/account.service.ts b/apps/api/src/app/account/account.service.ts
index 238e3d429..cb8467c18 100644
--- a/apps/api/src/app/account/account.service.ts
+++ b/apps/api/src/app/account/account.service.ts
@@ -21,10 +21,8 @@ export class AccountService {
public async account({
id_userId
}: Prisma.AccountWhereUniqueInput): Promise {
- const { id, userId } = id_userId;
-
const [account] = await this.accounts({
- where: { id, userId }
+ where: id_userId
});
return account;
diff --git a/apps/api/src/app/user/user.service.ts b/apps/api/src/app/user/user.service.ts
index 2c4d3760c..1f9fd0bf9 100644
--- a/apps/api/src/app/user/user.service.ts
+++ b/apps/api/src/app/user/user.service.ts
@@ -438,7 +438,7 @@ export class UserService {
settings
},
where: {
- userId: userId
+ userId
}
});
diff --git a/package.json b/package.json
index e06f09156..cb34bddd3 100644
--- a/package.json
+++ b/package.json
@@ -25,7 +25,7 @@
"database:push": "prisma db push",
"database:seed": "prisma db seed",
"database:setup": "yarn database:push && yarn database:seed",
- "database:validate": "prisma validate",
+ "database:validate-schema": "prisma validate",
"dep-graph": "nx dep-graph",
"e2e": "ng e2e",
"extract-locales": "nx run client:extract-i18n --output-path ./apps/client/src/locales",
diff --git a/prisma/migrations/20240221201438_added_missing_indexes/migration.sql b/prisma/migrations/20240221201438_added_missing_indexes/migration.sql
new file mode 100644
index 000000000..7de6885bd
--- /dev/null
+++ b/prisma/migrations/20240221201438_added_missing_indexes/migration.sql
@@ -0,0 +1,86 @@
+-- CreateIndex
+CREATE INDEX "Access_alias_idx" ON "Access"("alias");
+
+-- CreateIndex
+CREATE INDEX "Access_granteeUserId_idx" ON "Access"("granteeUserId");
+
+-- CreateIndex
+CREATE INDEX "Access_userId_idx" ON "Access"("userId");
+
+-- CreateIndex
+CREATE INDEX "Account_currency_idx" ON "Account"("currency");
+
+-- CreateIndex
+CREATE INDEX "Account_name_idx" ON "Account"("name");
+
+-- CreateIndex
+CREATE INDEX "Account_userId_idx" ON "Account"("userId");
+
+-- CreateIndex
+CREATE INDEX "AccountBalance_accountId_idx" ON "AccountBalance"("accountId");
+
+-- CreateIndex
+CREATE INDEX "AccountBalance_date_idx" ON "AccountBalance"("date");
+
+-- CreateIndex
+CREATE INDEX "Analytics_updatedAt_idx" ON "Analytics"("updatedAt");
+
+-- CreateIndex
+CREATE INDEX "AuthDevice_userId_idx" ON "AuthDevice"("userId");
+
+-- CreateIndex
+CREATE INDEX "MarketData_marketPrice_idx" ON "MarketData"("marketPrice");
+
+-- CreateIndex
+CREATE INDEX "MarketData_state_idx" ON "MarketData"("state");
+
+-- CreateIndex
+CREATE INDEX "Order_date_idx" ON "Order"("date");
+
+-- CreateIndex
+CREATE INDEX "Order_isDraft_idx" ON "Order"("isDraft");
+
+-- CreateIndex
+CREATE INDEX "Order_userId_idx" ON "Order"("userId");
+
+-- CreateIndex
+CREATE INDEX "Platform_name_idx" ON "Platform"("name");
+
+-- CreateIndex
+CREATE INDEX "Subscription_userId_idx" ON "Subscription"("userId");
+
+-- CreateIndex
+CREATE INDEX "SymbolProfile_assetClass_idx" ON "SymbolProfile"("assetClass");
+
+-- CreateIndex
+CREATE INDEX "SymbolProfile_currency_idx" ON "SymbolProfile"("currency");
+
+-- CreateIndex
+CREATE INDEX "SymbolProfile_dataSource_idx" ON "SymbolProfile"("dataSource");
+
+-- CreateIndex
+CREATE INDEX "SymbolProfile_isin_idx" ON "SymbolProfile"("isin");
+
+-- CreateIndex
+CREATE INDEX "SymbolProfile_name_idx" ON "SymbolProfile"("name");
+
+-- CreateIndex
+CREATE INDEX "SymbolProfile_symbol_idx" ON "SymbolProfile"("symbol");
+
+-- CreateIndex
+CREATE INDEX "Tag_name_idx" ON "Tag"("name");
+
+-- CreateIndex
+CREATE INDEX "User_accessToken_idx" ON "User"("accessToken");
+
+-- CreateIndex
+CREATE INDEX "User_createdAt_idx" ON "User"("createdAt");
+
+-- CreateIndex
+CREATE INDEX "User_provider_idx" ON "User"("provider");
+
+-- CreateIndex
+CREATE INDEX "User_role_idx" ON "User"("role");
+
+-- CreateIndex
+CREATE INDEX "User_thirdPartyId_idx" ON "User"("thirdPartyId");
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index ae36b00bf..4457254ba 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -19,6 +19,10 @@ model Access {
userId String
GranteeUser User? @relation("accessGet", fields: [granteeUserId], references: [id])
User User @relation("accessGive", fields: [userId], references: [id])
+
+ @@index([alias])
+ @@index([granteeUserId])
+ @@index([userId])
}
model Account {
@@ -39,7 +43,10 @@ model Account {
Order Order[]
@@id([id, userId])
+ @@index([currency])
@@index([id])
+ @@index([name])
+ @@index([userId])
}
model AccountBalance {
@@ -51,6 +58,9 @@ model AccountBalance {
userId String
value Float
Account Account @relation(fields: [accountId, userId], onDelete: Cascade, references: [id, userId])
+
+ @@index([accountId])
+ @@index([date])
}
model Analytics {
@@ -59,6 +69,8 @@ model Analytics {
updatedAt DateTime @updatedAt
userId String @id
User User @relation(fields: [userId], references: [id])
+
+ @@index([updatedAt])
}
model AuthDevice {
@@ -70,6 +82,8 @@ model AuthDevice {
updatedAt DateTime @updatedAt
userId String
User User @relation(fields: [userId], references: [id])
+
+ @@index([userId])
}
model MarketData {
@@ -84,6 +98,8 @@ model MarketData {
@@unique([dataSource, date, symbol])
@@index([dataSource])
@@index([date])
+ @@index([marketPrice])
+ @@index([state])
@@index([symbol])
}
@@ -108,6 +124,9 @@ model Order {
tags Tag[]
@@index([accountId])
+ @@index([date])
+ @@index([isDraft])
+ @@index([userId])
}
model Platform {
@@ -115,6 +134,8 @@ model Platform {
name String?
url String @unique
Account Account[]
+
+ @@index([name])
}
model Property {
@@ -153,6 +174,12 @@ model SymbolProfile {
SymbolProfileOverrides SymbolProfileOverrides?
@@unique([dataSource, symbol])
+ @@index([assetClass])
+ @@index([currency])
+ @@index([dataSource])
+ @@index([isin])
+ @@index([name])
+ @@index([symbol])
}
model SymbolProfileOverrides {
@@ -175,12 +202,16 @@ model Subscription {
updatedAt DateTime @updatedAt
userId String
User User @relation(fields: [userId], references: [id])
+
+ @@index([userId])
}
model Tag {
id String @id @default(uuid())
name String @unique
orders Order[]
+
+ @@index([name])
}
model User {
@@ -200,6 +231,12 @@ model User {
Order Order[]
Settings Settings?
Subscription Subscription[]
+
+ @@index([accessToken])
+ @@index([createdAt])
+ @@index([provider])
+ @@index([role])
+ @@index([thirdPartyId])
}
enum AccessPermission {
From 40836b745b118b4a9b38533a9e38adf70914fda3 Mon Sep 17 00:00:00 2001
From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com>
Date: Thu, 22 Feb 2024 20:25:22 +0100
Subject: [PATCH 18/56] Feature/improve validation for currency in endpoints
(#3030)
* Improve validation for currency
* Update changelog
---
CHANGELOG.md | 1 +
apps/api/src/app/account/create-account.dto.ts | 3 ++-
apps/api/src/app/account/update-account.dto.ts | 3 ++-
apps/api/src/app/admin/update-asset-profile.dto.ts | 3 ++-
apps/api/src/app/order/create-order.dto.ts | 3 ++-
apps/api/src/app/order/update-order.dto.ts | 3 ++-
apps/api/src/app/user/update-user-setting.dto.ts | 3 ++-
7 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b9648e42a..2fd016093 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
+- Improved the validation for `currency` in various endpoints
- Harmonized the setting of a default locale in various components
- Set the parser to `angular` in the `prettier` options
diff --git a/apps/api/src/app/account/create-account.dto.ts b/apps/api/src/app/account/create-account.dto.ts
index a6e07ad82..b719c2619 100644
--- a/apps/api/src/app/account/create-account.dto.ts
+++ b/apps/api/src/app/account/create-account.dto.ts
@@ -1,6 +1,7 @@
import { Transform, TransformFnParams } from 'class-transformer';
import {
IsBoolean,
+ IsISO4217CurrencyCode,
IsNumber,
IsOptional,
IsString,
@@ -19,7 +20,7 @@ export class CreateAccountDto {
)
comment?: string;
- @IsString()
+ @IsISO4217CurrencyCode()
currency: string;
@IsOptional()
diff --git a/apps/api/src/app/account/update-account.dto.ts b/apps/api/src/app/account/update-account.dto.ts
index 16d55386d..1b84a9bf6 100644
--- a/apps/api/src/app/account/update-account.dto.ts
+++ b/apps/api/src/app/account/update-account.dto.ts
@@ -1,6 +1,7 @@
import { Transform, TransformFnParams } from 'class-transformer';
import {
IsBoolean,
+ IsISO4217CurrencyCode,
IsNumber,
IsOptional,
IsString,
@@ -19,7 +20,7 @@ export class UpdateAccountDto {
)
comment?: string;
- @IsString()
+ @IsISO4217CurrencyCode()
currency: string;
@IsString()
diff --git a/apps/api/src/app/admin/update-asset-profile.dto.ts b/apps/api/src/app/admin/update-asset-profile.dto.ts
index 624acff9f..4a0457194 100644
--- a/apps/api/src/app/admin/update-asset-profile.dto.ts
+++ b/apps/api/src/app/admin/update-asset-profile.dto.ts
@@ -2,6 +2,7 @@ import { AssetClass, AssetSubClass, Prisma } from '@prisma/client';
import {
IsArray,
IsEnum,
+ IsISO4217CurrencyCode,
IsObject,
IsOptional,
IsString
@@ -24,7 +25,7 @@ export class UpdateAssetProfileDto {
@IsOptional()
countries?: Prisma.InputJsonArray;
- @IsString()
+ @IsISO4217CurrencyCode()
@IsOptional()
currency?: string;
diff --git a/apps/api/src/app/order/create-order.dto.ts b/apps/api/src/app/order/create-order.dto.ts
index f25a7ee12..aecec842a 100644
--- a/apps/api/src/app/order/create-order.dto.ts
+++ b/apps/api/src/app/order/create-order.dto.ts
@@ -10,6 +10,7 @@ import {
IsArray,
IsBoolean,
IsEnum,
+ IsISO4217CurrencyCode,
IsISO8601,
IsNumber,
IsOptional,
@@ -38,7 +39,7 @@ export class CreateOrderDto {
)
comment?: string;
- @IsString()
+ @IsISO4217CurrencyCode()
currency: string;
@IsOptional()
diff --git a/apps/api/src/app/order/update-order.dto.ts b/apps/api/src/app/order/update-order.dto.ts
index 3123d5665..c0a400c57 100644
--- a/apps/api/src/app/order/update-order.dto.ts
+++ b/apps/api/src/app/order/update-order.dto.ts
@@ -9,6 +9,7 @@ import { Transform, TransformFnParams } from 'class-transformer';
import {
IsArray,
IsEnum,
+ IsISO4217CurrencyCode,
IsISO8601,
IsNumber,
IsOptional,
@@ -37,7 +38,7 @@ export class UpdateOrderDto {
)
comment?: string;
- @IsString()
+ @IsISO4217CurrencyCode()
currency: string;
@IsString()
diff --git a/apps/api/src/app/user/update-user-setting.dto.ts b/apps/api/src/app/user/update-user-setting.dto.ts
index 317a31527..7b09ced10 100644
--- a/apps/api/src/app/user/update-user-setting.dto.ts
+++ b/apps/api/src/app/user/update-user-setting.dto.ts
@@ -7,6 +7,7 @@ import type {
import {
IsArray,
IsBoolean,
+ IsISO4217CurrencyCode,
IsISO8601,
IsIn,
IsNumber,
@@ -19,8 +20,8 @@ export class UpdateUserSettingDto {
@IsOptional()
annualInterestRate?: number;
+ @IsISO4217CurrencyCode()
@IsOptional()
- @IsString()
baseCurrency?: string;
@IsString()
From fefee11301b8cd6ea7841bc24bdb32f961fc4366 Mon Sep 17 00:00:00 2001
From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com>
Date: Thu, 22 Feb 2024 20:26:39 +0100
Subject: [PATCH 19/56] Release 2.55.0 (#3034)
---
CHANGELOG.md | 2 +-
package.json | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2fd016093..71f044dbb 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.55.0 - 2024-02-22
### Added
diff --git a/package.json b/package.json
index cb34bddd3..99054e7d7 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "ghostfolio",
- "version": "2.54.0",
+ "version": "2.55.0",
"homepage": "https://ghostfol.io",
"license": "AGPL-3.0",
"repository": "https://github.com/ghostfolio/ghostfolio",
From dbea0456bc594a726f37aa1782b97b66dd04e102 Mon Sep 17 00:00:00 2001
From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com>
Date: Fri, 23 Feb 2024 19:58:33 +0100
Subject: [PATCH 20/56] Update changelog (#3035)
---
CHANGELOG.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 71f044dbb..c0e0022df 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,9 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added indexes for `alias`, `granteeUserId` and `userId` to the access database table
- Added indexes for `currency`, `name` and `userId` to the account database table
-- Added an index for `accountId`, `date` and `updatedAt` to the account balance database table
+- Added indexes for `accountId`, `date` and `updatedAt` to the account balance database table
- Added an index for `userId` to the auth device database table
-- Added an index for `marketPrice` and `state` to the market data database table
+- Added indexes for `marketPrice` and `state` to the market data database table
- Added indexes for `date`, `isDraft` and `userId` to the order database table
- Added an index for `name` to the platform database table
- Added indexes for `assetClass`, `currency`, `dataSource`, `isin`, `name` and `symbol` to the symbol profile database table
From e7158f6e16247c93767f685ebcba8b016bfb9061 Mon Sep 17 00:00:00 2001
From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com>
Date: Sat, 24 Feb 2024 11:09:13 +0100
Subject: [PATCH 21/56] Feature/upgrade prisma to version 5.10.2 (#3038)
* Upgrade prisma to version 5.10.2
* Update changelog
---
CHANGELOG.md | 6 ++++
package.json | 4 +--
yarn.lock | 90 ++++++++++++++++++++++++++--------------------------
3 files changed, 53 insertions(+), 47 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c0e0022df..1c7dc3807 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
+
+### Changed
+
+- Upgraded `prisma` from version `5.9.1` to `5.10.2`
+
## 2.55.0 - 2024-02-22
### Added
diff --git a/package.json b/package.json
index 99054e7d7..f0d4ba62a 100644
--- a/package.json
+++ b/package.json
@@ -83,7 +83,7 @@
"@nestjs/platform-express": "10.1.3",
"@nestjs/schedule": "3.0.2",
"@nestjs/serve-static": "4.0.0",
- "@prisma/client": "5.9.1",
+ "@prisma/client": "5.10.2",
"@simplewebauthn/browser": "8.3.1",
"@simplewebauthn/server": "8.3.2",
"@stripe/stripe-js": "1.47.0",
@@ -125,7 +125,7 @@
"passport": "0.6.0",
"passport-google-oauth20": "2.0.0",
"passport-jwt": "4.0.0",
- "prisma": "5.9.1",
+ "prisma": "5.10.2",
"reflect-metadata": "0.1.13",
"rxjs": "7.5.6",
"stripe": "11.12.0",
diff --git a/yarn.lock b/yarn.lock
index dfba804f5..f71e7ad80 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -5275,46 +5275,46 @@
resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33"
integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==
-"@prisma/client@5.9.1":
- version "5.9.1"
- resolved "https://registry.yarnpkg.com/@prisma/client/-/client-5.9.1.tgz#d92bd2f7f006e0316cb4fda9d73f235965cf2c64"
- integrity sha512-caSOnG4kxcSkhqC/2ShV7rEoWwd3XrftokxJqOCMVvia4NYV/TPtJlS9C2os3Igxw/Qyxumj9GBQzcStzECvtQ==
-
-"@prisma/debug@5.9.1":
- version "5.9.1"
- resolved "https://registry.yarnpkg.com/@prisma/debug/-/debug-5.9.1.tgz#906274e73d3267f88b69459199fa3c51cd9511a3"
- integrity sha512-yAHFSFCg8KVoL0oRUno3m60GAjsUKYUDkQ+9BA2X2JfVR3kRVSJFc/GpQ2fSORi4pSHZR9orfM4UC9OVXIFFTA==
-
-"@prisma/engines-version@5.9.0-32.23fdc5965b1e05fc54e5f26ed3de66776b93de64":
- version "5.9.0-32.23fdc5965b1e05fc54e5f26ed3de66776b93de64"
- resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-5.9.0-32.23fdc5965b1e05fc54e5f26ed3de66776b93de64.tgz#54d2164f28d23e09d41cf9eb0bddbbe7f3aaa660"
- integrity sha512-HFl7275yF0FWbdcNvcSRbbu9JCBSLMcurYwvWc8WGDnpu7APxQo2ONtZrUggU3WxLxUJ2uBX+0GOFIcJeVeOOQ==
-
-"@prisma/engines@5.9.1":
- version "5.9.1"
- resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-5.9.1.tgz#767539afc6f193a182d0495b30b027f61f279073"
- integrity sha512-gkdXmjxQ5jktxWNdDA5aZZ6R8rH74JkoKq6LD5mACSvxd2vbqWeWIOV0Py5wFC8vofOYShbt6XUeCIUmrOzOnQ==
- dependencies:
- "@prisma/debug" "5.9.1"
- "@prisma/engines-version" "5.9.0-32.23fdc5965b1e05fc54e5f26ed3de66776b93de64"
- "@prisma/fetch-engine" "5.9.1"
- "@prisma/get-platform" "5.9.1"
-
-"@prisma/fetch-engine@5.9.1":
- version "5.9.1"
- resolved "https://registry.yarnpkg.com/@prisma/fetch-engine/-/fetch-engine-5.9.1.tgz#5d3b2c9af54a242e37b3f9561b59ab72f8e92818"
- integrity sha512-l0goQOMcNVOJs1kAcwqpKq3ylvkD9F04Ioe1oJoCqmz05mw22bNAKKGWuDd3zTUoUZr97va0c/UfLNru+PDmNA==
- dependencies:
- "@prisma/debug" "5.9.1"
- "@prisma/engines-version" "5.9.0-32.23fdc5965b1e05fc54e5f26ed3de66776b93de64"
- "@prisma/get-platform" "5.9.1"
-
-"@prisma/get-platform@5.9.1":
- version "5.9.1"
- resolved "https://registry.yarnpkg.com/@prisma/get-platform/-/get-platform-5.9.1.tgz#a66bb46ab4d30db786c84150ef074ab0aad4549e"
- integrity sha512-6OQsNxTyhvG+T2Ksr8FPFpuPeL4r9u0JF0OZHUBI/Uy9SS43sPyAIutt4ZEAyqWQt104ERh70EZedkHZKsnNbg==
- dependencies:
- "@prisma/debug" "5.9.1"
+"@prisma/client@5.10.2":
+ version "5.10.2"
+ resolved "https://registry.yarnpkg.com/@prisma/client/-/client-5.10.2.tgz#e087b40a4de8e3171eb9cbf0a873465cd2068e17"
+ integrity sha512-ef49hzB2yJZCvM5gFHMxSFL9KYrIP9udpT5rYo0CsHD4P9IKj473MbhU1gjKKftiwWBTIyrt9jukprzZXazyag==
+
+"@prisma/debug@5.10.2":
+ version "5.10.2"
+ resolved "https://registry.yarnpkg.com/@prisma/debug/-/debug-5.10.2.tgz#74be81d8969978f4d53c1b4e76d61f04bfbc3951"
+ integrity sha512-bkBOmH9dpEBbMKFJj8V+Zp8IZHIBjy3fSyhLhxj4FmKGb/UBSt9doyfA6k1UeUREsMJft7xgPYBbHSOYBr8XCA==
+
+"@prisma/engines-version@5.10.0-34.5a9203d0590c951969e85a7d07215503f4672eb9":
+ version "5.10.0-34.5a9203d0590c951969e85a7d07215503f4672eb9"
+ resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-5.10.0-34.5a9203d0590c951969e85a7d07215503f4672eb9.tgz#1502335d4d72d2014cb25b8ad8a740a3a13400ea"
+ integrity sha512-uCy/++3Jx/O3ufM+qv2H1L4tOemTNqcP/gyEVOlZqTpBvYJUe0tWtW0y3o2Ueq04mll4aM5X3f6ugQftOSLdFQ==
+
+"@prisma/engines@5.10.2":
+ version "5.10.2"
+ resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-5.10.2.tgz#a4851d90f76ad6d22e783d5fd2e2e8c0640f1e81"
+ integrity sha512-HkSJvix6PW8YqEEt3zHfCYYJY69CXsNdhU+wna+4Y7EZ+AwzeupMnUThmvaDA7uqswiHkgm5/SZ6/4CStjaGmw==
+ dependencies:
+ "@prisma/debug" "5.10.2"
+ "@prisma/engines-version" "5.10.0-34.5a9203d0590c951969e85a7d07215503f4672eb9"
+ "@prisma/fetch-engine" "5.10.2"
+ "@prisma/get-platform" "5.10.2"
+
+"@prisma/fetch-engine@5.10.2":
+ version "5.10.2"
+ resolved "https://registry.yarnpkg.com/@prisma/fetch-engine/-/fetch-engine-5.10.2.tgz#a061f6727d395c7033b55f9c6e92f8741a70d5c5"
+ integrity sha512-dSmXcqSt6DpTmMaLQ9K8ZKzVAMH3qwGCmYEZr/uVnzVhxRJ1EbT/w2MMwIdBNq1zT69Rvh0h75WMIi0mrIw7Hg==
+ dependencies:
+ "@prisma/debug" "5.10.2"
+ "@prisma/engines-version" "5.10.0-34.5a9203d0590c951969e85a7d07215503f4672eb9"
+ "@prisma/get-platform" "5.10.2"
+
+"@prisma/get-platform@5.10.2":
+ version "5.10.2"
+ resolved "https://registry.yarnpkg.com/@prisma/get-platform/-/get-platform-5.10.2.tgz#7af97b1d82e5574a474e3fbf6eaf04f4156bc535"
+ integrity sha512-nqXP6vHiY2PIsebBAuDeWiUYg8h8mfjBckHh6Jezuwej0QJNnjDiOq30uesmg+JXxGk99nqyG3B7wpcOODzXvg==
+ dependencies:
+ "@prisma/debug" "5.10.2"
"@radix-ui/number@1.0.1":
version "1.0.1"
@@ -16425,12 +16425,12 @@ pretty-hrtime@^1.0.3:
resolved "https://registry.yarnpkg.com/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz#b7e3ea42435a4c9b2759d99e0f201eb195802ee1"
integrity sha512-66hKPCr+72mlfiSjlEB1+45IjXSqvVAIy6mocupoww4tBFE9R9IhwwUGoI4G++Tc9Aq+2rxOt0RFU6gPcrte0A==
-prisma@5.9.1:
- version "5.9.1"
- resolved "https://registry.yarnpkg.com/prisma/-/prisma-5.9.1.tgz#baa3dd635fbf71504980978f10f55ea11068f6aa"
- integrity sha512-Hy/8KJZz0ELtkw4FnG9MS9rNWlXcJhf98Z2QMqi0QiVMoS8PzsBkpla0/Y5hTlob8F3HeECYphBjqmBxrluUrQ==
+prisma@5.10.2:
+ version "5.10.2"
+ resolved "https://registry.yarnpkg.com/prisma/-/prisma-5.10.2.tgz#aa63085c49dc74cdb5c3816e8dd1fb4d74a2aadd"
+ integrity sha512-hqb/JMz9/kymRE25pMWCxkdyhbnIWrq+h7S6WysJpdnCvhstbJSNP/S6mScEcqiB8Qv2F+0R3yG+osRaWqZacQ==
dependencies:
- "@prisma/engines" "5.9.1"
+ "@prisma/engines" "5.10.2"
prismjs@^1.28.0:
version "1.29.0"
From a3178fb2137f3e161d2dab3573677d4949090cdc Mon Sep 17 00:00:00 2001
From: miles
Date: Sat, 24 Feb 2024 18:56:12 +0800
Subject: [PATCH 22/56] Feature/expose redis database via environment variable
(#3036)
* Expose Redis database via environment variable
* Update changelog
---
CHANGELOG.md | 1 +
README.md | 1 +
apps/api/src/app/app.module.ts | 1 +
apps/api/src/app/redis-cache/redis-cache.module.ts | 1 +
apps/api/src/services/configuration/configuration.service.ts | 1 +
apps/api/src/services/interfaces/environment.interface.ts | 1 +
6 files changed, 6 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1c7dc3807..61cb9fcd5 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
+- Exposed the database index of _Redis_ as an environment variable (`REDIS_DB`)
- Upgraded `prisma` from version `5.9.1` to `5.10.2`
## 2.55.0 - 2024-02-22
diff --git a/README.md b/README.md
index 0d4bf3cfb..c82ad50c3 100644
--- a/README.md
+++ b/README.md
@@ -99,6 +99,7 @@ We provide official container images hosted on [Docker Hub](https://hub.docker.c
| `POSTGRES_DB` | | The name of the _PostgreSQL_ database |
| `POSTGRES_PASSWORD` | | The password of the _PostgreSQL_ database |
| `POSTGRES_USER` | | The user of the _PostgreSQL_ database |
+| `REDIS_DB` | `0` | The database index of _Redis_ |
| `REDIS_HOST` | | The host where _Redis_ is running |
| `REDIS_PASSWORD` | | The password of _Redis_ |
| `REDIS_PORT` | | The port where _Redis_ is running |
diff --git a/apps/api/src/app/app.module.ts b/apps/api/src/app/app.module.ts
index 506a76a8a..5f2be5c8e 100644
--- a/apps/api/src/app/app.module.ts
+++ b/apps/api/src/app/app.module.ts
@@ -53,6 +53,7 @@ import { UserModule } from './user/user.module';
BenchmarkModule,
BullModule.forRoot({
redis: {
+ db: parseInt(process.env.REDIS_DB ?? '0', 10),
host: process.env.REDIS_HOST,
port: parseInt(process.env.REDIS_PORT ?? '6379', 10),
password: process.env.REDIS_PASSWORD
diff --git a/apps/api/src/app/redis-cache/redis-cache.module.ts b/apps/api/src/app/redis-cache/redis-cache.module.ts
index 8acd644f6..4b4168168 100644
--- a/apps/api/src/app/redis-cache/redis-cache.module.ts
+++ b/apps/api/src/app/redis-cache/redis-cache.module.ts
@@ -15,6 +15,7 @@ import { RedisCacheService } from './redis-cache.service';
inject: [ConfigurationService],
useFactory: async (configurationService: ConfigurationService) => {
return {
+ db: configurationService.get('REDIS_DB'),
host: configurationService.get('REDIS_HOST'),
max: configurationService.get('MAX_ITEM_IN_CACHE'),
password: configurationService.get('REDIS_PASSWORD'),
diff --git a/apps/api/src/services/configuration/configuration.service.ts b/apps/api/src/services/configuration/configuration.service.ts
index 61a54daa1..eb82be418 100644
--- a/apps/api/src/services/configuration/configuration.service.ts
+++ b/apps/api/src/services/configuration/configuration.service.ts
@@ -43,6 +43,7 @@ export class ConfigurationService {
MAX_ACTIVITIES_TO_IMPORT: num({ default: Number.MAX_SAFE_INTEGER }),
MAX_ITEM_IN_CACHE: num({ default: 9999 }),
PORT: port({ default: 3333 }),
+ REDIS_DB: num({ default: 0 }),
REDIS_HOST: str({ default: 'localhost' }),
REDIS_PASSWORD: str({ default: '' }),
REDIS_PORT: port({ default: 6379 }),
diff --git a/apps/api/src/services/interfaces/environment.interface.ts b/apps/api/src/services/interfaces/environment.interface.ts
index 54abe22be..09d0b0e5d 100644
--- a/apps/api/src/services/interfaces/environment.interface.ts
+++ b/apps/api/src/services/interfaces/environment.interface.ts
@@ -30,6 +30,7 @@ export interface Environment extends CleanedEnvAccessors {
MAX_ACTIVITIES_TO_IMPORT: number;
MAX_ITEM_IN_CACHE: number;
PORT: number;
+ REDIS_DB: number;
REDIS_HOST: string;
REDIS_PASSWORD: string;
REDIS_PORT: number;
From 6be38a1c198edb9f271e1dc23cd4fb81ce00d04e Mon Sep 17 00:00:00 2001
From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com>
Date: Sat, 24 Feb 2024 19:44:56 +0100
Subject: [PATCH 23/56] Feature/remove is default flag from account database
schema (#3041)
* Remove isDefault flag from Account database schema
* Update changelog
---
CHANGELOG.md | 2 +
.../api/src/app/account/account.controller.ts | 2 +-
apps/api/src/app/user/user.service.ts | 10 +-
.../accounts-table.component.html | 9 +-
apps/client/src/app/pages/i18n/i18n-page.html | 1 +
.../activities/activities-page.component.ts | 7 +-
apps/client/src/locales/messages.de.xlf | 4362 +++++++++--------
apps/client/src/locales/messages.es.xlf | 4362 +++++++++--------
apps/client/src/locales/messages.fr.xlf | 4362 +++++++++--------
apps/client/src/locales/messages.it.xlf | 4360 ++++++++--------
apps/client/src/locales/messages.nl.xlf | 4360 ++++++++--------
apps/client/src/locales/messages.pl.xlf | 4276 ++++++++--------
apps/client/src/locales/messages.pt.xlf | 4362 +++++++++--------
apps/client/src/locales/messages.tr.xlf | 4360 ++++++++--------
apps/client/src/locales/messages.xlf | 4262 ++++++++--------
.../src/lib/interfaces/export.interface.ts | 2 +-
.../migration.sql | 2 +
prisma/schema.prisma | 1 -
18 files changed, 19622 insertions(+), 19480 deletions(-)
create mode 100644 prisma/migrations/20240224102024_removed_is_default_from_account/migration.sql
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 61cb9fcd5..f51662bd9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,7 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
+- Removed the `isDefault` flag from the `Account` database schema
- Exposed the database index of _Redis_ as an environment variable (`REDIS_DB`)
+- Improved the language localization for German (`de`)
- Upgraded `prisma` from version `5.9.1` to `5.10.2`
## 2.55.0 - 2024-02-22
diff --git a/apps/api/src/app/account/account.controller.ts b/apps/api/src/app/account/account.controller.ts
index 4bee65966..31c2ee76f 100644
--- a/apps/api/src/app/account/account.controller.ts
+++ b/apps/api/src/app/account/account.controller.ts
@@ -63,7 +63,7 @@ export class AccountController {
{ Order: true }
);
- if (account?.isDefault || account?.Order.length > 0) {
+ if (!account || account?.Order.length > 0) {
throw new HttpException(
getReasonPhrase(StatusCodes.FORBIDDEN),
StatusCodes.FORBIDDEN
diff --git a/apps/api/src/app/user/user.service.ts b/apps/api/src/app/user/user.service.ts
index 1f9fd0bf9..e20dea4af 100644
--- a/apps/api/src/app/user/user.service.ts
+++ b/apps/api/src/app/user/user.service.ts
@@ -1,11 +1,13 @@
import { SubscriptionService } from '@ghostfolio/api/app/subscription/subscription.service';
import { environment } from '@ghostfolio/api/environments/environment';
import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service';
+import { I18nService } from '@ghostfolio/api/services/i18n/i18n.service';
import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service';
import { PropertyService } from '@ghostfolio/api/services/property/property.service';
import { TagService } from '@ghostfolio/api/services/tag/tag.service';
import {
DEFAULT_CURRENCY,
+ DEFAULT_LANGUAGE_CODE,
PROPERTY_IS_READ_ONLY_MODE,
PROPERTY_SYSTEM_MESSAGE,
locale
@@ -31,6 +33,8 @@ const crypto = require('crypto');
@Injectable()
export class UserService {
+ private i18nService = new I18nService();
+
public constructor(
private readonly configurationService: ConfigurationService,
private readonly prismaService: PrismaService,
@@ -325,8 +329,10 @@ export class UserService {
Account: {
create: {
currency: DEFAULT_CURRENCY,
- isDefault: true,
- name: 'Default Account'
+ name: this.i18nService.getTranslation({
+ id: 'myAccount',
+ languageCode: DEFAULT_LANGUAGE_CODE // TODO
+ })
}
},
Settings: {
diff --git a/apps/client/src/app/components/accounts-table/accounts-table.component.html b/apps/client/src/app/components/accounts-table/accounts-table.component.html
index 47473d303..cd4f139c4 100644
--- a/apps/client/src/app/components/accounts-table/accounts-table.component.html
+++ b/apps/client/src/app/components/accounts-table/accounts-table.component.html
@@ -40,12 +40,7 @@
[tooltip]="element.Platform?.name"
[url]="element.Platform?.url"
/>
- {{ element.name }}
- (Default)
+ {{ element.name }}
Total
@@ -261,7 +256,7 @@
0"
+ [disabled]="element.transactionCount > 0"
(click)="onDeleteAccount(element.id)"
>
diff --git a/apps/client/src/app/pages/i18n/i18n-page.html b/apps/client/src/app/pages/i18n/i18n-page.html
index 4922b01cd..b23129c45 100644
--- a/apps/client/src/app/pages/i18n/i18n-page.html
+++ b/apps/client/src/app/pages/i18n/i18n-page.html
@@ -10,6 +10,7 @@
app, asset, cryptocurrency, dashboard, etf, finance, management,
performance, portfolio, software, stock, trading, wealth, web3
+ My Account
Open Source Wealth Management Software
diff --git a/apps/client/src/app/pages/portfolio/activities/activities-page.component.ts b/apps/client/src/app/pages/portfolio/activities/activities-page.component.ts
index 6bb636512..190fc673e 100644
--- a/apps/client/src/app/pages/portfolio/activities/activities-page.component.ts
+++ b/apps/client/src/app/pages/portfolio/activities/activities-page.component.ts
@@ -36,7 +36,6 @@ import { ImportActivitiesDialogParams } from './import-activities-dialog/interfa
export class ActivitiesPageComponent implements OnDestroy, OnInit {
public activities: Activity[];
public dataSource: MatTableDataSource