From 873fd537158b92c0a47b99f4fb0e0275a751212d Mon Sep 17 00:00:00 2001 From: Eduardo Marinho <87383586+SirZemar@users.noreply.github.com> Date: Wed, 12 Jun 2024 19:28:55 +0100 Subject: [PATCH 1/5] Feature/extend market data with currencies preset by activities count and date (#3460) * Extend market data with currencies preset by activities count and date * Update changelog --- CHANGELOG.md | 4 ++ apps/api/src/app/admin/admin.service.ts | 63 ++++++++++++------- .../interfaces/admin-market-data.interface.ts | 4 +- 3 files changed, 47 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ddc7f796e..ddd17a698 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 + +- Extended the historical market data table with currencies preset by date and activities count in the admin control panel + ### Changed - Improved the language localization for German (`de`) diff --git a/apps/api/src/app/admin/admin.service.ts b/apps/api/src/app/admin/admin.service.ts index 3323e775d..c061c996c 100644 --- a/apps/api/src/app/admin/admin.service.ts +++ b/apps/api/src/app/admin/admin.service.ts @@ -409,30 +409,49 @@ export class AdminService { by: ['dataSource', 'symbol'] }); - const marketData: AdminMarketDataItem[] = this.exchangeRateDataService - .getCurrencyPairs() - .map(({ dataSource, symbol }) => { - const marketDataItemCount = - marketDataItems.find((marketDataItem) => { - return ( - marketDataItem.dataSource === dataSource && - marketDataItem.symbol === symbol - ); - })?._count ?? 0; + const marketDataPromise: Promise[] = + this.exchangeRateDataService + .getCurrencyPairs() + .map(async ({ dataSource, symbol }) => { + const currency = symbol.replace(DEFAULT_CURRENCY, ''); + + const { _count, _min } = await this.prismaService.order.aggregate({ + _count: true, + _min: { + date: true + }, + where: { + SymbolProfile: { + currency + } + } + }); - return { - dataSource, - marketDataItemCount, - symbol, - assetClass: AssetClass.LIQUIDITY, - countriesCount: 0, - currency: symbol.replace(DEFAULT_CURRENCY, ''), - id: undefined, - name: symbol, - sectorsCount: 0 - }; - }); + const marketDataItemCount = + marketDataItems.find((marketDataItem) => { + return ( + marketDataItem.dataSource === dataSource && + marketDataItem.symbol === symbol + ); + })?._count ?? 0; + + return { + currency, + dataSource, + marketDataItemCount, + symbol, + activitiesCount: _count as number, + assetClass: AssetClass.LIQUIDITY, + assetSubClass: AssetSubClass.CASH, + countriesCount: 0, + date: _min.date, + id: undefined, + name: symbol, + sectorsCount: 0 + }; + }); + const marketData = await Promise.all(marketDataPromise); return { marketData, count: marketData.length }; } diff --git a/libs/common/src/lib/interfaces/admin-market-data.interface.ts b/libs/common/src/lib/interfaces/admin-market-data.interface.ts index 6f3a82a0b..d52ac03b9 100644 --- a/libs/common/src/lib/interfaces/admin-market-data.interface.ts +++ b/libs/common/src/lib/interfaces/admin-market-data.interface.ts @@ -6,13 +6,13 @@ export interface AdminMarketData { } export interface AdminMarketDataItem { - activitiesCount?: number; + activitiesCount: number; assetClass?: AssetClass; assetSubClass?: AssetSubClass; countriesCount: number; currency: string; dataSource: DataSource; - date?: Date; + date: Date; id: string; isBenchmark?: boolean; marketDataItemCount: number; From f24561cc3d976a0d7532f03b736e26cf5ab2c824 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Thu, 13 Jun 2024 12:07:42 +0200 Subject: [PATCH 2/5] Feature/improve style of personal finance tools list (#3486) --- .../personal-finance-tools/personal-finance-tools-page.html | 4 ++-- .../personal-finance-tools/personal-finance-tools-page.scss | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/client/src/app/pages/resources/personal-finance-tools/personal-finance-tools-page.html b/apps/client/src/app/pages/resources/personal-finance-tools/personal-finance-tools-page.html index 90b7b3ad1..f3c128433 100644 --- a/apps/client/src/app/pages/resources/personal-finance-tools/personal-finance-tools-page.html +++ b/apps/client/src/app/pages/resources/personal-finance-tools/personal-finance-tools-page.html @@ -23,11 +23,11 @@ track personalFinanceTool ) { - +
Date: Thu, 13 Jun 2024 12:08:15 +0200 Subject: [PATCH 3/5] Feature/improve language localization (#3487) * Update translations --- apps/client/src/locales/messages.es.xlf | 24 ++++++++++++------------ apps/client/src/locales/messages.fr.xlf | 24 ++++++++++++------------ apps/client/src/locales/messages.it.xlf | 2 +- apps/client/src/locales/messages.pt.xlf | 22 +++++++++++----------- apps/client/src/locales/messages.tr.xlf | 4 ++-- 5 files changed, 38 insertions(+), 38 deletions(-) diff --git a/apps/client/src/locales/messages.es.xlf b/apps/client/src/locales/messages.es.xlf index 16dd3e6a6..510ac87a5 100644 --- a/apps/client/src/locales/messages.es.xlf +++ b/apps/client/src/locales/messages.es.xlf @@ -4340,7 +4340,7 @@ Discover Open Source Alternatives for Personal Finance Tools - Discover Open Source Alternatives for Personal Finance Tools + Descubra alternativas de software libre para herramientas de finanzas personales apps/client/src/app/pages/resources/personal-finance-tools/personal-finance-tools-page.html 4 @@ -4348,7 +4348,7 @@ Founded - Founded + Fundada apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 72 @@ -4356,7 +4356,7 @@ Origin - Origin + Origen apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 77 @@ -4364,7 +4364,7 @@ Region - Region + Región apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 82 @@ -4372,7 +4372,7 @@ Available in - Available in + Disponible en apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 87 @@ -4464,7 +4464,7 @@ Use anonymously - Use anonymously + Uso anónimo apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 148 @@ -4472,7 +4472,7 @@ Free Plan - Free Plan + Plan gratuito apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 167 @@ -4480,7 +4480,7 @@ Notes - Notes + Notas apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 201 @@ -4488,7 +4488,7 @@ Effortlessly track, analyze, and visualize your wealth with Ghostfolio. - Effortlessly track, analyze, and visualize your wealth with Ghostfolio. + Siga, analice y visualice su patrimonio sin esfuerzo con Ghostfolio. apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 227 @@ -4888,7 +4888,7 @@ Get Started - Get Started + Empezar apps/client/src/app/pages/landing/landing-page.html 41 @@ -5644,7 +5644,7 @@ Ready to take your investments to the next level? - Ready to take your investments to the next level? + ¿Listo para llevar sus inversiones al siguiente nivel? apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 223 @@ -5984,7 +5984,7 @@ Ghostfolio vs comparison table - Ghostfolio vs comparison table + Ghostfolio vs tabla comparativa apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 49 diff --git a/apps/client/src/locales/messages.fr.xlf b/apps/client/src/locales/messages.fr.xlf index 4921caeb1..53df9ea28 100644 --- a/apps/client/src/locales/messages.fr.xlf +++ b/apps/client/src/locales/messages.fr.xlf @@ -3687,7 +3687,7 @@ Get Started - Débuter + Démarrer apps/client/src/app/pages/landing/landing-page.html 438 @@ -4339,7 +4339,7 @@ Discover Open Source Alternatives for Personal Finance Tools - Discover Open Source Alternatives for Personal Finance Tools + Découvrez les alternatives Open Source pour les outils de finance personnelle apps/client/src/app/pages/resources/personal-finance-tools/personal-finance-tools-page.html 4 @@ -4347,7 +4347,7 @@ Founded - Founded + Fondée apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 72 @@ -4355,7 +4355,7 @@ Origin - Origin + L’origine apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 77 @@ -4363,7 +4363,7 @@ Region - Region + La région apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 82 @@ -4371,7 +4371,7 @@ Available in - Available in + Disponible en apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 87 @@ -4463,7 +4463,7 @@ Use anonymously - Use anonymously + Utilisation anonyme apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 148 @@ -4471,7 +4471,7 @@ Free Plan - Free Plan + Plan gratuit apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 167 @@ -4479,7 +4479,7 @@ Notes - Notes + Notes apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 201 @@ -4887,7 +4887,7 @@ Get Started - Get Started + Démarrer apps/client/src/app/pages/landing/landing-page.html 41 @@ -5651,7 +5651,7 @@ Get Started - Get Started + Démarrer apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 232 @@ -5983,7 +5983,7 @@ Ghostfolio vs comparison table - Ghostfolio vs comparison table + Ghostfolio vs tableau comparatif apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 49 diff --git a/apps/client/src/locales/messages.it.xlf b/apps/client/src/locales/messages.it.xlf index ce5e92498..dc0c7854b 100644 --- a/apps/client/src/locales/messages.it.xlf +++ b/apps/client/src/locales/messages.it.xlf @@ -5984,7 +5984,7 @@ Ghostfolio vs comparison table - Ghostfolio vs comparison table + Ghostfolio vs tabella di comparazione apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 49 diff --git a/apps/client/src/locales/messages.pt.xlf b/apps/client/src/locales/messages.pt.xlf index 02cfeca2d..fa981c351 100644 --- a/apps/client/src/locales/messages.pt.xlf +++ b/apps/client/src/locales/messages.pt.xlf @@ -4339,7 +4339,7 @@ Discover Open Source Alternatives for Personal Finance Tools - Discover Open Source Alternatives for Personal Finance Tools + Descubra alternativas de software livre para ferramentas de finanças pessoais apps/client/src/app/pages/resources/personal-finance-tools/personal-finance-tools-page.html 4 @@ -4347,7 +4347,7 @@ Founded - Founded + Fundada apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 72 @@ -4355,7 +4355,7 @@ Origin - Origin + Origem apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 77 @@ -4363,7 +4363,7 @@ Region - Region + Região apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 82 @@ -4371,7 +4371,7 @@ Available in - Available in + Disponível em apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 87 @@ -4463,7 +4463,7 @@ Use anonymously - Use anonymously + Utilizar anonimamente apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 148 @@ -4471,7 +4471,7 @@ Free Plan - Free Plan + Plano gratuito apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 167 @@ -4479,7 +4479,7 @@ Notes - Notes + Notas apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 201 @@ -4887,7 +4887,7 @@ Get Started - Get Started + Começar apps/client/src/app/pages/landing/landing-page.html 41 @@ -5651,7 +5651,7 @@ Get Started - Get Started + Começar apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 232 @@ -5983,7 +5983,7 @@ Ghostfolio vs comparison table - Ghostfolio vs comparison table + Ghostfolio vs tabela de comparação apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 49 diff --git a/apps/client/src/locales/messages.tr.xlf b/apps/client/src/locales/messages.tr.xlf index dcac786fe..1871686f4 100644 --- a/apps/client/src/locales/messages.tr.xlf +++ b/apps/client/src/locales/messages.tr.xlf @@ -4547,7 +4547,7 @@ Open Source Alternative to - için Açık Kaynak Alternatifi + Open Source Alternative to apps/client/src/app/pages/resources/personal-finance-tools/personal-finance-tools-page.html 42 @@ -4563,7 +4563,7 @@ Are you looking for an open source alternative to ? Ghostfolio is a powerful portfolio management tool that provides individuals with a comprehensive platform to track, analyze, and optimize their investments. Whether you are an experienced investor or just starting out, Ghostfolio offers an intuitive user interface and a wide range of functionalities to help you make informed decisions and take control of your financial future. - ? yerine Açık Kaynak Kodlu bir alternatif mi arıyorsunuz? Ghostfolio,kullanıcılara yatırımlarını izlemek, analiz ve optimize etmek için kapsamlı bir platform sunan güçlü bir portföy yönetim aracıdır. Deneyimli bir yatırımcı da olsanuz henüz başlamış da olsanız, Ghostfolio sezgileri güçlü bir kullanıcı arayüzü ile geniş spektrumlu bir fonksiyon seti sunarak bilgiye dayalı kararlar vermenizi ve finansal geleceğinizin kontrolünü elinize almanızı sağlar. + Are you looking for an open source alternative to ? Ghostfolio is a powerful portfolio management tool that provides individuals with a comprehensive platform to track, analyze, and optimize their investments. Whether you are an experienced investor or just starting out, Ghostfolio offers an intuitive user interface and a wide range of functionalities to help you make informed decisions and take control of your financial future. apps/client/src/app/pages/resources/personal-finance-tools/product-page.html 13 From bf20a5de8201e3c6ee8dfb27f62ef3adeb28045c Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Fri, 14 Jun 2024 03:40:47 +0200 Subject: [PATCH 4/5] Feature/improve date validation in activity endpoints (#3489) * Improve date validation * Update changelog --- CHANGELOG.md | 1 + apps/api/src/app/order/create-order.dto.ts | 6 +++++- apps/api/src/app/order/update-order.dto.ts | 6 +++++- ...eate-or-update-activity-dialog.component.ts | 10 +++++++++- .../create-or-update-activity-dialog.html | 7 ++++++- .../lib/validator-constraints/is-after-1970.ts | 16 ++++++++++++++++ test/import/invalid-date-before-min.json | 18 ++++++++++++++++++ 7 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 libs/common/src/lib/validator-constraints/is-after-1970.ts create mode 100644 test/import/invalid-date-before-min.json diff --git a/CHANGELOG.md b/CHANGELOG.md index ddd17a698..a1db2164f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Improved the date validation in the create, import and update activities endpoints - Improved the language localization for German (`de`) ## 2.88.0 - 2024-06-11 diff --git a/apps/api/src/app/order/create-order.dto.ts b/apps/api/src/app/order/create-order.dto.ts index 6d36f036a..72aba3a3b 100644 --- a/apps/api/src/app/order/create-order.dto.ts +++ b/apps/api/src/app/order/create-order.dto.ts @@ -1,3 +1,5 @@ +import { IsAfter1970Constraint } from '@ghostfolio/common/validator-constraints/is-after-1970'; + import { AssetClass, AssetSubClass, @@ -15,7 +17,8 @@ import { IsNumber, IsOptional, IsString, - Min + Min, + Validate } from 'class-validator'; import { isString } from 'lodash'; @@ -51,6 +54,7 @@ export class CreateOrderDto { dataSource?: DataSource; @IsISO8601() + @Validate(IsAfter1970Constraint) date: string; @IsNumber() diff --git a/apps/api/src/app/order/update-order.dto.ts b/apps/api/src/app/order/update-order.dto.ts index be3c2b6e5..2fd33b743 100644 --- a/apps/api/src/app/order/update-order.dto.ts +++ b/apps/api/src/app/order/update-order.dto.ts @@ -1,3 +1,5 @@ +import { IsAfter1970Constraint } from '@ghostfolio/common/validator-constraints/is-after-1970'; + import { AssetClass, AssetSubClass, @@ -14,7 +16,8 @@ import { IsNumber, IsOptional, IsString, - Min + Min, + Validate } from 'class-validator'; import { isString } from 'lodash'; @@ -49,6 +52,7 @@ export class UpdateOrderDto { dataSource: DataSource; @IsISO8601() + @Validate(IsAfter1970Constraint) date: string; @IsNumber() diff --git a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts index 9d3bcc6c9..8ebf936a2 100644 --- a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts +++ b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts @@ -21,7 +21,7 @@ import { DateAdapter, MAT_DATE_LOCALE } from '@angular/material/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { AssetClass, AssetSubClass, Tag, Type } from '@prisma/client'; import { isUUID } from 'class-validator'; -import { isToday } from 'date-fns'; +import { isAfter, isToday } from 'date-fns'; import { EMPTY, Observable, Subject, lastValueFrom, of } from 'rxjs'; import { catchError, delay, map, startWith, takeUntil } from 'rxjs/operators'; @@ -426,6 +426,14 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { }); } + public dateFilter(aDate: Date) { + if (!aDate) { + return true; + } + + return isAfter(aDate, new Date(0)); + } + public onAddTag(event: MatAutocompleteSelectedEvent) { this.activityForm.get('tags').setValue([ ...(this.activityForm.get('tags').value ?? []), diff --git a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.html b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.html index f57d63559..a3b960d82 100644 --- a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.html +++ b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.html @@ -157,7 +157,12 @@
Date - + Date: Fri, 14 Jun 2024 03:43:47 +0200 Subject: [PATCH 5/5] Release 2.89.0 (#3491) --- CHANGELOG.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1db2164f..f5ed45c44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## 2.89.0 - 2024-06-14 ### Added diff --git a/package.json b/package.json index 21621f3df..9e3fa7b73 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ghostfolio", - "version": "2.88.0", + "version": "2.89.0", "homepage": "https://ghostfol.io", "license": "AGPL-3.0", "repository": "https://github.com/ghostfolio/ghostfolio",