Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/support note in accounts (#2063)
Thomas Kaul911644330594
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 1cdd9430f8..fdd2cbea79 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0## Unreleased+### Added++- Supported a note for accounts+### Changed- Improved the language localization for French (`fr`)diff --git a/apps/api/src/app/account/create-account.dto.ts b/apps/api/src/app/account/create-account.dto.tsindex 6495fa518b..c700e7fa94 100644--- a/apps/api/src/app/account/create-account.dto.ts+++ b/apps/api/src/app/account/create-account.dto.ts@@ -1,4 +1,5 @@import { AccountType } from '@prisma/client';+import { Transform, TransformFnParams } from 'class-transformer';import {IsBoolean,IsNumber,@@ -6,6 +7,7 @@ import {IsString,ValidateIf} from 'class-validator';+import { isString } from 'lodash';export class CreateAccountDto {@IsString()@@ -14,6 +16,13 @@ export class CreateAccountDto {@IsNumber()balance: number;+ @IsOptional()+ @IsString()+ @Transform(({ value }: TransformFnParams) =>+ isString(value) ? value.trim() : value+ )+ comment?: string;+@IsString()currency: string;diff --git a/apps/api/src/app/account/update-account.dto.ts b/apps/api/src/app/account/update-account.dto.tsindex 0b5737607f..d8c62aff78 100644--- a/apps/api/src/app/account/update-account.dto.ts+++ b/apps/api/src/app/account/update-account.dto.ts@@ -1,4 +1,5 @@import { AccountType } from '@prisma/client';+import { Transform, TransformFnParams } from 'class-transformer';import {IsBoolean,IsNumber,@@ -6,6 +7,7 @@ import {IsString,ValidateIf} from 'class-validator';+import { isString } from 'lodash';export class UpdateAccountDto {@IsString()@@ -14,6 +16,13 @@ export class UpdateAccountDto {@IsNumber()balance: number;+ @IsOptional()+ @IsString()+ @Transform(({ value }: TransformFnParams) =>+ isString(value) ? value.trim() : value+ )+ comment?: string;+@IsString()currency: string;diff --git a/apps/api/src/app/export/export.service.ts b/apps/api/src/app/export/export.service.tsindex c8bd651a67..eaeea0f079 100644--- a/apps/api/src/app/export/export.service.ts+++ b/apps/api/src/app/export/export.service.ts@@ -21,6 +21,7 @@ export class ExportService {select: {accountType: true,balance: true,+ comment: true,currency: true,id: true,isExcluded: true,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.htmlindex 0ab9ea9afd..0b859321fb 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@@ -207,6 +207,30 @@</td></ng-container>+ <ng-container matColumnDef="comment">+ <th+ *matHeaderCellDef+ class="d-none d-lg-table-cell px-1"+ mat-header-cell+ ></th>+ <td *matCellDef="let element" class="d-none d-lg-table-cell px-1" mat-cell>+ <button+ *ngIf="element.comment"+ class="mx-1 no-min-width px-2"+ mat-button+ title="Note"+ (click)="onOpenComment(element.comment); $event.stopPropagation()"+ >+ <ion-icon name="document-text-outline"></ion-icon>+ </button>+ </td>+ <td+ *matFooterCellDef+ class="d-none d-lg-table-cell px-1"+ mat-footer-cell+ ></td>+ </ng-container>+<ng-container matColumnDef="actions"><th *matHeaderCellDef class="px-1 text-center" i18n mat-header-cell></th><td *matCellDef="let element" class="px-1 text-center" mat-cell>diff --git a/apps/client/src/app/components/accounts-table/accounts-table.component.ts b/apps/client/src/app/components/accounts-table/accounts-table.component.tsindex 8ec0f86fb4..77b7b4d0f9 100644--- a/apps/client/src/app/components/accounts-table/accounts-table.component.ts+++ b/apps/client/src/app/components/accounts-table/accounts-table.component.ts@@ -58,7 +58,8 @@ export class AccountsTableComponent implements OnChanges, OnDestroy, OnInit {'balance','value','currency',- 'valueInBaseCurrency'+ 'valueInBaseCurrency',+ 'comment'];if (this.showActions) {@@ -92,6 +93,10 @@ export class AccountsTableComponent implements OnChanges, OnDestroy, OnInit {});}+ public onOpenComment(aComment: string) {+ alert(aComment);+ }+public onUpdateAccount(aAccount: AccountModel) {this.accountToUpdate.emit(aAccount);}diff --git a/apps/client/src/app/pages/accounts/accounts-page.component.ts b/apps/client/src/app/pages/accounts/accounts-page.component.tsindex dc1fa590e6..96bd06816c 100644--- a/apps/client/src/app/pages/accounts/accounts-page.component.ts+++ b/apps/client/src/app/pages/accounts/accounts-page.component.ts@@ -153,6 +153,7 @@ export class AccountsPageComponent implements OnDestroy, OnInit {public openUpdateAccountDialog({accountType,balance,+ comment,currency,id,isExcluded,@@ -164,6 +165,7 @@ export class AccountsPageComponent implements OnDestroy, OnInit {account: {accountType,balance,+ comment,currency,id,isExcluded,@@ -232,6 +234,7 @@ export class AccountsPageComponent implements OnDestroy, OnInit {account: {accountType: AccountType.SECURITIES,balance: 0,+ comment: null,currency: this.user?.settings?.baseCurrency,isExcluded: false,name: null,diff --git a/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.html b/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.htmlindex fca606d279..5413d08b36 100644--- a/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.html+++ b/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.html@@ -50,6 +50,19 @@</mat-select></mat-form-field></div>+ <div>+ <mat-form-field appearance="outline" class="w-100">+ <mat-label i18n>Note</mat-label>+ <textarea+ cdkAutosizeMinRows="2"+ cdkTextareaAutosize+ matInput+ name="comment"+ [(ngModel)]="data.account.comment"+ (keyup.enter)="$event.stopPropagation()"+ ></textarea>+ </mat-form-field>+ </div><div class="mb-3 px-2"><mat-checkboxcolor="primary"diff --git a/prisma/migrations/20230610083653_added_comment_to_account/migration.sql b/prisma/migrations/20230610083653_added_comment_to_account/migration.sqlnew file mode 100644index 0000000000..f354b1e64b--- /dev/null+++ b/prisma/migrations/20230610083653_added_comment_to_account/migration.sql@@ -0,0 +1,2 @@+-- AlterTable+ALTER TABLE "Account" ADD COLUMN "comment" TEXT;diff --git a/prisma/schema.prisma b/prisma/schema.prismaindex cb67499292..2957ce7e54 100644--- a/prisma/schema.prisma+++ b/prisma/schema.prisma@@ -23,6 +23,7 @@ model Access {model Account {accountType AccountType @default(SECURITIES)balance Float @default(0)+ comment String?createdAt DateTime @default(now())currency String?id String @default(uuid())