Feature/remove account type from user interface (#2335)

* Remove account type from user interface and set it optional

* Update changelog
pull/2337/head
Thomas Kaul 8 months ago committed by GitHub
parent 8fc5676443
commit ab691bb27a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Harmonized the style of the user interface for granting and revoking public access to share the portfolio
- Removed the account type from the user interface as a preparation to remove it from the `Account` database schema
- Improved the logger output of the info service
- Harmonized the logger output: <symbol> (<dataSource>)
- Improved the language localization for Italian (`it`)

@ -10,6 +10,7 @@ import {
import { isString } from 'lodash';
export class CreateAccountDto {
@IsOptional()
@IsString()
accountType: AccountType;

@ -10,6 +10,7 @@ import {
import { isString } from 'lodash';
export class UpdateAccountDto {
@IsOptional()
@IsString()
accountType: AccountType;

@ -26,18 +26,8 @@ export class ExportService {
where: { userId }
})
).map(
({
accountType,
balance,
comment,
currency,
id,
isExcluded,
name,
platformId
}) => {
({ balance, comment, currency, id, isExcluded, name, platformId }) => {
return {
accountType,
balance,
comment,
currency,

@ -29,13 +29,13 @@ import { AccountDetailDialogParams } from './interfaces/interfaces';
styleUrls: ['./account-detail-dialog.component.scss']
})
export class AccountDetailDialog implements OnDestroy, OnInit {
public accountType: string;
public balance: number;
public currency: string;
public equity: number;
public name: string;
public orders: OrderWithAccount[];
public platformName: string;
public transactionCount: number;
public user: User;
public valueInBaseCurrency: number;
@ -65,15 +65,14 @@ export class AccountDetailDialog implements OnDestroy, OnInit {
.pipe(takeUntil(this.unsubscribeSubject))
.subscribe(
({
accountType,
balance,
currency,
name,
Platform,
transactionCount,
value,
valueInBaseCurrency
}) => {
this.accountType = translate(accountType);
this.balance = balance;
this.currency = currency;
@ -85,6 +84,7 @@ export class AccountDetailDialog implements OnDestroy, OnInit {
this.name = name;
this.platformName = Platform?.name ?? '-';
this.transactionCount = transactionCount;
this.valueInBaseCurrency = valueInBaseCurrency;
this.changeDetectorRef.markForCheck();

@ -44,8 +44,8 @@
>
</div>
<div class="col-6 mb-3">
<gf-value i18n size="medium" [value]="accountType"
>Account Type</gf-value
<gf-value i18n size="medium" [value]="transactionCount"
>Activities</gf-value
>
</div>
<div class="col-6 mb-3">

@ -85,7 +85,7 @@
<ng-container matColumnDef="transactions">
<th
*matHeaderCellDef
class="px-1 text-right"
class="justify-content-end px-1"
mat-header-cell
mat-sort-header="transactionCount"
>
@ -93,9 +93,7 @@
<span class="d-none d-sm-block" i18n>Activities</span>
</th>
<td *matCellDef="let element" class="px-1 text-right" mat-cell>
<ng-container *ngIf="element.accountType === 'SECURITIES'">{{
element.transactionCount
}}</ng-container>
{{ element.transactionCount }}
</td>
<td *matFooterCellDef class="px-1 text-right" mat-footer-cell>
{{ transactionCount }}

@ -10,7 +10,7 @@ import { ImpersonationStorageService } from '@ghostfolio/client/services/imperso
import { UserService } from '@ghostfolio/client/services/user/user.service';
import { User } from '@ghostfolio/common/interfaces';
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
import { Account as AccountModel, AccountType } from '@prisma/client';
import { Account as AccountModel } from '@prisma/client';
import { DeviceDetectorService } from 'ngx-device-detector';
import { Subject, Subscription } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
@ -151,7 +151,6 @@ export class AccountsPageComponent implements OnDestroy, OnInit {
}
public openUpdateAccountDialog({
accountType,
balance,
comment,
currency,
@ -163,7 +162,6 @@ export class AccountsPageComponent implements OnDestroy, OnInit {
const dialogRef = this.dialog.open(CreateOrUpdateAccountDialog, {
data: {
account: {
accountType,
balance,
comment,
currency,
@ -232,7 +230,6 @@ export class AccountsPageComponent implements OnDestroy, OnInit {
const dialogRef = this.dialog.open(CreateOrUpdateAccountDialog, {
data: {
account: {
accountType: AccountType.SECURITIES,
balance: 0,
comment: null,
currency: this.user?.settings?.baseCurrency,

@ -8,15 +8,6 @@
<input matInput name="name" required [(ngModel)]="data.account.name" />
</mat-form-field>
</div>
<div>
<mat-form-field appearance="outline" class="w-100">
<mat-label i18n>Type</mat-label>
<mat-select name="type" required [(value)]="data.account.accountType">
<mat-option i18n value="CASH">Cash</mat-option>
<mat-option i18n value="SECURITIES">Securities</mat-option>
</mat-select>
</mat-form-field>
</div>
<div>
<mat-form-field appearance="outline" class="w-100">
<mat-label i18n>Currency</mat-label>

@ -238,9 +238,7 @@ export class ActivitiesPageComponent implements OnDestroy, OnInit {
const dialogRef = this.dialog.open(CreateOrUpdateActivityDialog, {
data: {
activity,
accounts: this.user?.accounts?.filter((account) => {
return account.accountType === 'SECURITIES';
}),
accounts: this.user?.accounts,
user: this.user
},
height: this.deviceType === 'mobile' ? '97.5vh' : '80vh',
@ -282,9 +280,7 @@ export class ActivitiesPageComponent implements OnDestroy, OnInit {
const dialogRef = this.dialog.open(CreateOrUpdateActivityDialog, {
data: {
accounts: this.user?.accounts?.filter((account) => {
return account.accountType === 'SECURITIES';
}),
accounts: this.user?.accounts,
activity: {
...aActivity,
accountId: aActivity?.accountId ?? this.defaultAccountId,

@ -173,17 +173,15 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
if (state?.user) {
this.user = state.user;
const accountFilters: Filter[] = this.user.accounts
.filter(({ accountType }) => {
return accountType === 'SECURITIES';
})
.map(({ id, name }) => {
const accountFilters: Filter[] = this.user.accounts.map(
({ id, name }) => {
return {
id,
label: name,
type: 'ACCOUNT'
};
});
}
);
const assetClassFilters: Filter[] = [];
for (const assetClass of Object.keys(AssetClass)) {

@ -139,17 +139,15 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
if (state?.user) {
this.user = state.user;
const accountFilters: Filter[] = this.user.accounts
.filter(({ accountType }) => {
return accountType === 'SECURITIES';
})
.map(({ id, name }) => {
const accountFilters: Filter[] = this.user.accounts.map(
({ id, name }) => {
return {
id,
label: name,
type: 'ACCOUNT'
};
});
}
);
const assetClassFilters: Filter[] = [];
for (const assetClass of Object.keys(AssetClass)) {

@ -114,17 +114,15 @@ export class HoldingsPageComponent implements OnDestroy, OnInit {
permissions.createOrder
);
const accountFilters: Filter[] = this.user.accounts
.filter(({ accountType }) => {
return accountType === 'SECURITIES';
})
.map(({ id, name }) => {
const accountFilters: Filter[] = this.user.accounts.map(
({ id, name }) => {
return {
id,
label: name,
type: 'ACCOUNT'
};
});
}
);
const assetClassFilters: Filter[] = [];
for (const assetClass of Object.keys(AssetClass)) {

@ -5,7 +5,10 @@ export interface Export {
date: string;
version: string;
};
accounts: Omit<Account, 'createdAt' | 'isDefault' | 'updatedAt' | 'userId'>[];
accounts: Omit<
Account,
'accountType' | 'createdAt' | 'isDefault' | 'updatedAt' | 'userId'
>[];
activities: (Omit<
Order,
| 'accountUserId'

@ -21,7 +21,6 @@ const locales = {
PRESET_ID: $localize`Preset`,
RETIREMENT_PROVISION: $localize`Retirement Provision`,
SATELLITE: $localize`Satellite`,
SECURITIES: $localize`Securities`,
SYMBOL: $localize`Symbol`,
TAG: $localize`Tag`,
YEAR: $localize`Year`,

@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE "Account" ALTER COLUMN "accountType" DROP NOT NULL,
ALTER COLUMN "accountType" DROP DEFAULT;

@ -21,7 +21,7 @@ model Access {
}
model Account {
accountType AccountType @default(SECURITIES)
accountType AccountType?
balance Float @default(0)
balances AccountBalance[]
comment String?

@ -5,7 +5,6 @@
},
"accounts": [
{
"accountType": "SECURITIES",
"balance": 2000,
"currency": "USD",
"id": "b2d3fe1d-d6a8-41a3-be39-07ef5e9480f0",
@ -6016,4 +6015,4 @@
"symbol": "AAPL"
}
]
}
}

@ -5,7 +5,6 @@
},
"accounts": [
{
"accountType": "SECURITIES",
"balance": 2000,
"currency": "USD",
"id": "b2d3fe1d-d6a8-41a3-be39-07ef5e9480f0",

Loading…
Cancel
Save