Feature/remove is default flag from account database schema (#3041)
* Remove isDefault flag from Account database schema * Update changelog
This commit is contained in:
parent
a3178fb213
commit
6be38a1c19
@ -9,7 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
- Removed the `isDefault` flag from the `Account` database schema
|
||||||
- Exposed the database index of _Redis_ as an environment variable (`REDIS_DB`)
|
- 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`
|
- Upgraded `prisma` from version `5.9.1` to `5.10.2`
|
||||||
|
|
||||||
## 2.55.0 - 2024-02-22
|
## 2.55.0 - 2024-02-22
|
||||||
|
@ -63,7 +63,7 @@ export class AccountController {
|
|||||||
{ Order: true }
|
{ Order: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
if (account?.isDefault || account?.Order.length > 0) {
|
if (!account || account?.Order.length > 0) {
|
||||||
throw new HttpException(
|
throw new HttpException(
|
||||||
getReasonPhrase(StatusCodes.FORBIDDEN),
|
getReasonPhrase(StatusCodes.FORBIDDEN),
|
||||||
StatusCodes.FORBIDDEN
|
StatusCodes.FORBIDDEN
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
import { SubscriptionService } from '@ghostfolio/api/app/subscription/subscription.service';
|
import { SubscriptionService } from '@ghostfolio/api/app/subscription/subscription.service';
|
||||||
import { environment } from '@ghostfolio/api/environments/environment';
|
import { environment } from '@ghostfolio/api/environments/environment';
|
||||||
import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service';
|
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 { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service';
|
||||||
import { PropertyService } from '@ghostfolio/api/services/property/property.service';
|
import { PropertyService } from '@ghostfolio/api/services/property/property.service';
|
||||||
import { TagService } from '@ghostfolio/api/services/tag/tag.service';
|
import { TagService } from '@ghostfolio/api/services/tag/tag.service';
|
||||||
import {
|
import {
|
||||||
DEFAULT_CURRENCY,
|
DEFAULT_CURRENCY,
|
||||||
|
DEFAULT_LANGUAGE_CODE,
|
||||||
PROPERTY_IS_READ_ONLY_MODE,
|
PROPERTY_IS_READ_ONLY_MODE,
|
||||||
PROPERTY_SYSTEM_MESSAGE,
|
PROPERTY_SYSTEM_MESSAGE,
|
||||||
locale
|
locale
|
||||||
@ -31,6 +33,8 @@ const crypto = require('crypto');
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class UserService {
|
export class UserService {
|
||||||
|
private i18nService = new I18nService();
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
private readonly configurationService: ConfigurationService,
|
private readonly configurationService: ConfigurationService,
|
||||||
private readonly prismaService: PrismaService,
|
private readonly prismaService: PrismaService,
|
||||||
@ -325,8 +329,10 @@ export class UserService {
|
|||||||
Account: {
|
Account: {
|
||||||
create: {
|
create: {
|
||||||
currency: DEFAULT_CURRENCY,
|
currency: DEFAULT_CURRENCY,
|
||||||
isDefault: true,
|
name: this.i18nService.getTranslation({
|
||||||
name: 'Default Account'
|
id: 'myAccount',
|
||||||
|
languageCode: DEFAULT_LANGUAGE_CODE // TODO
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Settings: {
|
Settings: {
|
||||||
|
@ -40,12 +40,7 @@
|
|||||||
[tooltip]="element.Platform?.name"
|
[tooltip]="element.Platform?.name"
|
||||||
[url]="element.Platform?.url"
|
[url]="element.Platform?.url"
|
||||||
/>
|
/>
|
||||||
<span>{{ element.name }} </span>
|
<span>{{ element.name }}</span>
|
||||||
<span
|
|
||||||
*ngIf="element.isDefault"
|
|
||||||
class="d-lg-inline-block d-none text-muted"
|
|
||||||
>(Default)</span
|
|
||||||
>
|
|
||||||
</td>
|
</td>
|
||||||
<td *matFooterCellDef class="px-1" i18n mat-footer-cell>Total</td>
|
<td *matFooterCellDef class="px-1" i18n mat-footer-cell>Total</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
@ -261,7 +256,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
mat-menu-item
|
mat-menu-item
|
||||||
[disabled]="element.isDefault || element.transactionCount > 0"
|
[disabled]="element.transactionCount > 0"
|
||||||
(click)="onDeleteAccount(element.id)"
|
(click)="onDeleteAccount(element.id)"
|
||||||
>
|
>
|
||||||
<span class="align-items-center d-flex">
|
<span class="align-items-center d-flex">
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
app, asset, cryptocurrency, dashboard, etf, finance, management,
|
app, asset, cryptocurrency, dashboard, etf, finance, management,
|
||||||
performance, portfolio, software, stock, trading, wealth, web3
|
performance, portfolio, software, stock, trading, wealth, web3
|
||||||
</li>
|
</li>
|
||||||
|
<li i18n="@@myAccount">My Account</li>
|
||||||
<li i18n="@@slogan">Open Source Wealth Management Software</li>
|
<li i18n="@@slogan">Open Source Wealth Management Software</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -36,7 +36,6 @@ import { ImportActivitiesDialogParams } from './import-activities-dialog/interfa
|
|||||||
export class ActivitiesPageComponent implements OnDestroy, OnInit {
|
export class ActivitiesPageComponent implements OnDestroy, OnInit {
|
||||||
public activities: Activity[];
|
public activities: Activity[];
|
||||||
public dataSource: MatTableDataSource<Activity>;
|
public dataSource: MatTableDataSource<Activity>;
|
||||||
public defaultAccountId: string;
|
|
||||||
public deviceType: string;
|
public deviceType: string;
|
||||||
public hasImpersonationId: boolean;
|
public hasImpersonationId: boolean;
|
||||||
public hasPermissionToCreateActivity: boolean;
|
public hasPermissionToCreateActivity: boolean;
|
||||||
@ -323,7 +322,7 @@ export class ActivitiesPageComponent implements OnDestroy, OnInit {
|
|||||||
accounts: this.user?.accounts,
|
accounts: this.user?.accounts,
|
||||||
activity: {
|
activity: {
|
||||||
...aActivity,
|
...aActivity,
|
||||||
accountId: aActivity?.accountId ?? this.defaultAccountId,
|
accountId: aActivity?.accountId,
|
||||||
date: new Date(),
|
date: new Date(),
|
||||||
id: null,
|
id: null,
|
||||||
fee: 0,
|
fee: 0,
|
||||||
@ -399,10 +398,6 @@ export class ActivitiesPageComponent implements OnDestroy, OnInit {
|
|||||||
private updateUser(aUser: User) {
|
private updateUser(aUser: User) {
|
||||||
this.user = aUser;
|
this.user = aUser;
|
||||||
|
|
||||||
this.defaultAccountId = this.user?.accounts.find((account) => {
|
|
||||||
return account.isDefault;
|
|
||||||
})?.id;
|
|
||||||
|
|
||||||
this.hasPermissionToCreateActivity =
|
this.hasPermissionToCreateActivity =
|
||||||
!this.hasImpersonationId &&
|
!this.hasImpersonationId &&
|
||||||
hasPermission(this.user.permissions, permissions.createOrder);
|
hasPermission(this.user.permissions, permissions.createOrder);
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,7 @@ export interface Export {
|
|||||||
date: string;
|
date: string;
|
||||||
version: string;
|
version: string;
|
||||||
};
|
};
|
||||||
accounts: Omit<Account, 'createdAt' | 'isDefault' | 'updatedAt' | 'userId'>[];
|
accounts: Omit<Account, 'createdAt' | 'updatedAt' | 'userId'>[];
|
||||||
activities: (Omit<
|
activities: (Omit<
|
||||||
Order,
|
Order,
|
||||||
| 'accountUserId'
|
| 'accountUserId'
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "Account" DROP COLUMN "isDefault";
|
@ -32,7 +32,6 @@ model Account {
|
|||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
currency String?
|
currency String?
|
||||||
id String @default(uuid())
|
id String @default(uuid())
|
||||||
isDefault Boolean @default(false)
|
|
||||||
isExcluded Boolean @default(false)
|
isExcluded Boolean @default(false)
|
||||||
name String?
|
name String?
|
||||||
platformId String?
|
platformId String?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user