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] 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 @@