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
|
||||
|
||||
- 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
|
||||
|
@ -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
|
||||
|
@ -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: {
|
||||
|
@ -41,11 +41,6 @@
|
||||
[url]="element.Platform?.url"
|
||||
/>
|
||||
<span>{{ element.name }}</span>
|
||||
<span
|
||||
*ngIf="element.isDefault"
|
||||
class="d-lg-inline-block d-none text-muted"
|
||||
>(Default)</span
|
||||
>
|
||||
</td>
|
||||
<td *matFooterCellDef class="px-1" i18n mat-footer-cell>Total</td>
|
||||
</ng-container>
|
||||
@ -261,7 +256,7 @@
|
||||
</button>
|
||||
<button
|
||||
mat-menu-item
|
||||
[disabled]="element.isDefault || element.transactionCount > 0"
|
||||
[disabled]="element.transactionCount > 0"
|
||||
(click)="onDeleteAccount(element.id)"
|
||||
>
|
||||
<span class="align-items-center d-flex">
|
||||
|
@ -10,6 +10,7 @@
|
||||
app, asset, cryptocurrency, dashboard, etf, finance, management,
|
||||
performance, portfolio, software, stock, trading, wealth, web3
|
||||
</li>
|
||||
<li i18n="@@myAccount">My Account</li>
|
||||
<li i18n="@@slogan">Open Source Wealth Management Software</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -36,7 +36,6 @@ import { ImportActivitiesDialogParams } from './import-activities-dialog/interfa
|
||||
export class ActivitiesPageComponent implements OnDestroy, OnInit {
|
||||
public activities: Activity[];
|
||||
public dataSource: MatTableDataSource<Activity>;
|
||||
public defaultAccountId: string;
|
||||
public deviceType: string;
|
||||
public hasImpersonationId: boolean;
|
||||
public hasPermissionToCreateActivity: boolean;
|
||||
@ -323,7 +322,7 @@ export class ActivitiesPageComponent implements OnDestroy, OnInit {
|
||||
accounts: this.user?.accounts,
|
||||
activity: {
|
||||
...aActivity,
|
||||
accountId: aActivity?.accountId ?? this.defaultAccountId,
|
||||
accountId: aActivity?.accountId,
|
||||
date: new Date(),
|
||||
id: null,
|
||||
fee: 0,
|
||||
@ -399,10 +398,6 @@ export class ActivitiesPageComponent implements OnDestroy, OnInit {
|
||||
private updateUser(aUser: User) {
|
||||
this.user = aUser;
|
||||
|
||||
this.defaultAccountId = this.user?.accounts.find((account) => {
|
||||
return account.isDefault;
|
||||
})?.id;
|
||||
|
||||
this.hasPermissionToCreateActivity =
|
||||
!this.hasImpersonationId &&
|
||||
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;
|
||||
version: string;
|
||||
};
|
||||
accounts: Omit<Account, 'createdAt' | 'isDefault' | 'updatedAt' | 'userId'>[];
|
||||
accounts: Omit<Account, 'createdAt' | 'updatedAt' | 'userId'>[];
|
||||
activities: (Omit<
|
||||
Order,
|
||||
| 'accountUserId'
|
||||
|
@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Account" DROP COLUMN "isDefault";
|
@ -32,7 +32,6 @@ model Account {
|
||||
createdAt DateTime @default(now())
|
||||
currency String?
|
||||
id String @default(uuid())
|
||||
isDefault Boolean @default(false)
|
||||
isExcluded Boolean @default(false)
|
||||
name String?
|
||||
platformId String?
|
||||
|
Loading…
x
Reference in New Issue
Block a user