From b418310c33c33c17a9e9ced962635412a5435246 Mon Sep 17 00:00:00 2001 From: Thomas <4159106+dtslvr@users.noreply.github.com> Date: Fri, 15 Sep 2023 16:18:41 +0200 Subject: [PATCH] Remove account type from user interface and set it optional --- apps/api/src/app/account/create-account.dto.ts | 1 + apps/api/src/app/account/update-account.dto.ts | 1 + apps/api/src/app/export/export.service.ts | 12 +----------- .../account-detail-dialog.component.ts | 6 +++--- .../account-detail-dialog/account-detail-dialog.html | 4 ++-- .../accounts-table/accounts-table.component.html | 6 ++---- .../app/pages/accounts/accounts-page.component.ts | 5 +---- .../create-or-update-account-dialog.html | 9 --------- .../activities/activities-page.component.ts | 8 ++------ .../allocations/allocations-page.component.ts | 10 ++++------ .../portfolio/analysis/analysis-page.component.ts | 10 ++++------ .../portfolio/holdings/holdings-page.component.ts | 10 ++++------ libs/common/src/lib/interfaces/export.interface.ts | 5 ++++- libs/ui/src/lib/i18n.ts | 1 - .../migration.sql | 3 +++ prisma/schema.prisma | 2 +- test/import/ok-500-activities.json | 3 +-- test/import/ok.json | 1 - 18 files changed, 34 insertions(+), 63 deletions(-) create mode 100644 prisma/migrations/20230915141658_changed_account_type_to_optional_in_account/migration.sql diff --git a/apps/api/src/app/account/create-account.dto.ts b/apps/api/src/app/account/create-account.dto.ts index c700e7fa9..eb24d959a 100644 --- a/apps/api/src/app/account/create-account.dto.ts +++ b/apps/api/src/app/account/create-account.dto.ts @@ -10,6 +10,7 @@ import { import { isString } from 'lodash'; export class CreateAccountDto { + @IsOptional() @IsString() accountType: AccountType; diff --git a/apps/api/src/app/account/update-account.dto.ts b/apps/api/src/app/account/update-account.dto.ts index d8c62aff7..a91914482 100644 --- a/apps/api/src/app/account/update-account.dto.ts +++ b/apps/api/src/app/account/update-account.dto.ts @@ -10,6 +10,7 @@ import { import { isString } from 'lodash'; export class UpdateAccountDto { + @IsOptional() @IsString() accountType: AccountType; diff --git a/apps/api/src/app/export/export.service.ts b/apps/api/src/app/export/export.service.ts index abeaf389d..fb7e09d41 100644 --- a/apps/api/src/app/export/export.service.ts +++ b/apps/api/src/app/export/export.service.ts @@ -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, diff --git a/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.component.ts b/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.component.ts index 06e4cebf6..3a4746b6b 100644 --- a/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.component.ts +++ b/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.component.ts @@ -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(); diff --git a/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.html b/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.html index 126c33ac5..46a5ee7b0 100644 --- a/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.html +++ b/apps/client/src/app/components/account-detail-dialog/account-detail-dialog.html @@ -44,8 +44,8 @@ >