From fc3613be4e50936212576b91364b6517992c6b70 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Fri, 21 Feb 2025 20:42:34 +0100 Subject: [PATCH 1/4] Feature/upgrade prettier to version 3.5.1 (#4342) * Upgrade prettier to version 3.5.1 * Update changelog --- CHANGELOG.md | 6 ++++++ package-lock.json | 8 ++++---- package.json | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3df5a97c..3bb4e27be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ 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 + +### Changed + +- Upgraded `prettier` from version `3.4.2` to `3.5.1` + ## 2.140.0 - 2025-02-20 ### Changed diff --git a/package-lock.json b/package-lock.json index e604c275b..0fd7572e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -149,7 +149,7 @@ "jest-environment-jsdom": "29.7.0", "jest-preset-angular": "14.4.2", "nx": "20.3.2", - "prettier": "3.4.2", + "prettier": "3.5.1", "prettier-plugin-organize-attributes": "1.0.0", "prisma": "6.3.0", "react": "18.2.0", @@ -27104,9 +27104,9 @@ } }, "node_modules/prettier": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz", - "integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==", + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.1.tgz", + "integrity": "sha512-hPpFQvHwL3Qv5AdRvBFMhnKo4tYxp0ReXiPn2bxkiohEX6mBeBwEpBSQTkD458RaaDKQMYSp4hX4UtfUTA5wDw==", "dev": true, "license": "MIT", "bin": { diff --git a/package.json b/package.json index c3bd3a0d0..2a3881183 100644 --- a/package.json +++ b/package.json @@ -195,7 +195,7 @@ "jest-environment-jsdom": "29.7.0", "jest-preset-angular": "14.4.2", "nx": "20.3.2", - "prettier": "3.4.2", + "prettier": "3.5.1", "prettier-plugin-organize-attributes": "1.0.0", "prisma": "6.3.0", "react": "18.2.0", From 05b0728b2ac7838ba7b2c614335f379466120dcb Mon Sep 17 00:00:00 2001 From: Sayed Murtadha Ahmed Date: Sat, 22 Feb 2025 11:20:39 +0300 Subject: [PATCH 2/4] Feature/extend export by tags (#4337) * Extend export by tags * Update changelog --- CHANGELOG.md | 4 +++ apps/api/src/app/export/export.module.ts | 3 +- apps/api/src/app/export/export.service.ts | 30 ++++++++++++++----- .../src/lib/interfaces/export.interface.ts | 11 +++---- 4 files changed, 34 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bb4e27be..eac524907 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 export functionality by the tags + ### Changed - Upgraded `prettier` from version `3.4.2` to `3.5.1` diff --git a/apps/api/src/app/export/export.module.ts b/apps/api/src/app/export/export.module.ts index 048c60359..892a761cc 100644 --- a/apps/api/src/app/export/export.module.ts +++ b/apps/api/src/app/export/export.module.ts @@ -1,6 +1,7 @@ import { AccountModule } from '@ghostfolio/api/app/account/account.module'; import { OrderModule } from '@ghostfolio/api/app/order/order.module'; import { ApiModule } from '@ghostfolio/api/services/api/api.module'; +import { TagModule } from '@ghostfolio/api/services/tag/tag.module'; import { Module } from '@nestjs/common'; @@ -8,7 +9,7 @@ import { ExportController } from './export.controller'; import { ExportService } from './export.service'; @Module({ - imports: [AccountModule, ApiModule, OrderModule], + imports: [AccountModule, ApiModule, OrderModule, TagModule], controllers: [ExportController], providers: [ExportService] }) diff --git a/apps/api/src/app/export/export.service.ts b/apps/api/src/app/export/export.service.ts index 1ff18ce9c..219ffffda 100644 --- a/apps/api/src/app/export/export.service.ts +++ b/apps/api/src/app/export/export.service.ts @@ -1,6 +1,7 @@ import { AccountService } from '@ghostfolio/api/app/account/account.service'; import { OrderService } from '@ghostfolio/api/app/order/order.service'; import { environment } from '@ghostfolio/api/environments/environment'; +import { TagService } from '@ghostfolio/api/services/tag/tag.service'; import { Filter, Export } from '@ghostfolio/common/interfaces'; import { Injectable } from '@nestjs/common'; @@ -9,7 +10,8 @@ import { Injectable } from '@nestjs/common'; export class ExportService { public constructor( private readonly accountService: AccountService, - private readonly orderService: OrderService + private readonly orderService: OrderService, + private readonly tagService: TagService ) {} public async export({ @@ -60,9 +62,21 @@ export class ExportService { }); } + const tags = (await this.tagService.getTagsForUser(userId)) + .filter(({ isUsed }) => { + return isUsed; + }) + .map(({ id, name }) => { + return { + id, + name + }; + }); + return { meta: { date: new Date().toISOString(), version: environment.version }, accounts, + tags, activities: activities.map( ({ accountId, @@ -72,6 +86,7 @@ export class ExportService { id, quantity, SymbolProfile, + tags: currentTags, type, unitPrice }) => { @@ -86,13 +101,12 @@ export class ExportService { currency: SymbolProfile.currency, dataSource: SymbolProfile.dataSource, date: date.toISOString(), - symbol: - type === 'FEE' || - type === 'INTEREST' || - type === 'ITEM' || - type === 'LIABILITY' - ? SymbolProfile.name - : SymbolProfile.symbol + symbol: ['FEE', 'INTEREST', 'ITEM', 'LIABILITY'].includes(type) + ? SymbolProfile.name + : SymbolProfile.symbol, + tags: currentTags.map(({ id: tagId }) => { + return tagId; + }) }; } ), diff --git a/libs/common/src/lib/interfaces/export.interface.ts b/libs/common/src/lib/interfaces/export.interface.ts index de3d7cf02..1257e50bc 100644 --- a/libs/common/src/lib/interfaces/export.interface.ts +++ b/libs/common/src/lib/interfaces/export.interface.ts @@ -1,10 +1,6 @@ -import { Account, Order } from '@prisma/client'; +import { Account, Order, Tag } from '@prisma/client'; export interface Export { - meta: { - date: string; - version: string; - }; accounts: Omit[]; activities: (Omit< Order, @@ -16,5 +12,10 @@ export interface Export { | 'updatedAt' | 'userId' > & { date: string; symbol: string })[]; + meta: { + date: string; + version: string; + }; + tags: Omit[]; user: { settings: { currency: string } }; } From 7577a452f0b5f042c5dbd0c31e9a79ebe5867ea9 Mon Sep 17 00:00:00 2001 From: Shaunak Das <51281688+shaun-ak@users.noreply.github.com> Date: Sun, 23 Feb 2025 13:20:59 +0530 Subject: [PATCH 3/4] Feature/add activities count to GET user endpoint (#4351) * Add activities count to GET user endpoint * Update changelog --- CHANGELOG.md | 1 + apps/api/src/app/user/user.service.ts | 9 +++++++-- libs/common/src/lib/interfaces/user.interface.ts | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eac524907..7fd3aaf6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Extended the export functionality by the tags +- Extended the user endpoint `GET api/v1/user` by the activities count ### Changed diff --git a/apps/api/src/app/user/user.service.ts b/apps/api/src/app/user/user.service.ts index dcf9d9404..40bc1b2b5 100644 --- a/apps/api/src/app/user/user.service.ts +++ b/apps/api/src/app/user/user.service.ts @@ -86,6 +86,9 @@ export class UserService { orderBy: { alias: 'asc' }, where: { GranteeUser: { id } } }), + this.prismaService.order.count({ + where: { userId: id } + }), this.prismaService.order.findFirst({ orderBy: { date: 'asc' @@ -96,8 +99,9 @@ export class UserService { ]); const access = userData[0]; - const firstActivity = userData[1]; - let tags = userData[2]; + const activitiesCount = userData[1]; + const firstActivity = userData[2]; + let tags = userData[3]; let systemMessage: SystemMessage; @@ -117,6 +121,7 @@ export class UserService { } return { + activitiesCount, id, permissions, subscription, diff --git a/libs/common/src/lib/interfaces/user.interface.ts b/libs/common/src/lib/interfaces/user.interface.ts index 667e59fd8..84f48d1dc 100644 --- a/libs/common/src/lib/interfaces/user.interface.ts +++ b/libs/common/src/lib/interfaces/user.interface.ts @@ -10,6 +10,7 @@ import { UserSettings } from './user-settings.interface'; export interface User { access: Pick[]; accounts: Account[]; + activitiesCount: number; dateOfFirstActivity: Date; id: string; permissions: string[]; From 190abdf9cc390eefeeee7028cf2eba0c30256303 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Mon, 24 Feb 2025 13:53:05 +0100 Subject: [PATCH 4/4] Bugfix/improve numeric comparison of strings in value component (#4330) * Improve numeric comparison of strings * Update changelog --- CHANGELOG.md | 4 ++++ libs/ui/src/lib/value/value.component.html | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fd3aaf6b..019bf4b6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Upgraded `prettier` from version `3.4.2` to `3.5.1` +### Fixed + +- Improved the numeric comparison of strings in the value component + ## 2.140.0 - 2025-02-20 ### Changed diff --git a/libs/ui/src/lib/value/value.component.html b/libs/ui/src/lib/value/value.component.html index a691c54e8..0ead7497e 100644 --- a/libs/ui/src/lib/value/value.component.html +++ b/libs/ui/src/lib/value/value.component.html @@ -10,8 +10,8 @@ > -
+
-
-
+
+
+
-