Browse Source

Merge branch 'main' into feature/add-cusip-to-asset-profile-model

pull/4347/head
Thomas Kaul 2 months ago
committed by GitHub
parent
commit
454d3da46d
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      CHANGELOG.md
  2. 1
      apps/api/src/app/portfolio/calculator/portfolio-calculator.ts
  3. 3
      apps/api/src/app/portfolio/calculator/twr/portfolio-calculator.ts
  4. 9
      apps/api/src/app/user/user.service.ts
  5. 1
      libs/common/src/lib/interfaces/user.interface.ts
  6. 2
      libs/common/src/lib/models/portfolio-snapshot.ts
  7. 4
      libs/ui/src/lib/value/value.component.html

6
CHANGELOG.md

@ -10,12 +10,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- Extended the export functionality by the tags - Extended the export functionality by the tags
- Extended the portfolio snapshot in the portfolio calculator by the activities count
- Extended the user endpoint `GET api/v1/user` by the activities count
- Added `cusip` to the asset profile model - Added `cusip` to the asset profile model
### Changed ### Changed
- Upgraded `prettier` from version `3.4.2` to `3.5.1` - 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 ## 2.140.0 - 2025-02-20
### Changed ### Changed

1
apps/api/src/app/portfolio/calculator/portfolio-calculator.ts

@ -175,6 +175,7 @@ export abstract class PortfolioCalculator {
if (!transactionPoints.length) { if (!transactionPoints.length) {
return { return {
activitiesCount: 0,
currentValueInBaseCurrency: new Big(0), currentValueInBaseCurrency: new Big(0),
errors: [], errors: [],
hasErrors: false, hasErrors: false,

3
apps/api/src/app/portfolio/calculator/twr/portfolio-calculator.ts

@ -101,6 +101,9 @@ export class TWRPortfolioCalculator extends PortfolioCalculator {
totalInterestWithCurrencyEffect, totalInterestWithCurrencyEffect,
totalInvestment, totalInvestment,
totalInvestmentWithCurrencyEffect, totalInvestmentWithCurrencyEffect,
activitiesCount: this.activities.filter(({ type }) => {
return ['BUY', 'SELL'].includes(type);
}).length,
errors: [], errors: [],
historicalData: [], historicalData: [],
totalLiabilitiesWithCurrencyEffect: new Big(0), totalLiabilitiesWithCurrencyEffect: new Big(0),

9
apps/api/src/app/user/user.service.ts

@ -86,6 +86,9 @@ export class UserService {
orderBy: { alias: 'asc' }, orderBy: { alias: 'asc' },
where: { GranteeUser: { id } } where: { GranteeUser: { id } }
}), }),
this.prismaService.order.count({
where: { userId: id }
}),
this.prismaService.order.findFirst({ this.prismaService.order.findFirst({
orderBy: { orderBy: {
date: 'asc' date: 'asc'
@ -96,8 +99,9 @@ export class UserService {
]); ]);
const access = userData[0]; const access = userData[0];
const firstActivity = userData[1]; const activitiesCount = userData[1];
let tags = userData[2]; const firstActivity = userData[2];
let tags = userData[3];
let systemMessage: SystemMessage; let systemMessage: SystemMessage;
@ -117,6 +121,7 @@ export class UserService {
} }
return { return {
activitiesCount,
id, id,
permissions, permissions,
subscription, subscription,

1
libs/common/src/lib/interfaces/user.interface.ts

@ -10,6 +10,7 @@ import { UserSettings } from './user-settings.interface';
export interface User { export interface User {
access: Pick<Access, 'alias' | 'id' | 'permissions'>[]; access: Pick<Access, 'alias' | 'id' | 'permissions'>[];
accounts: Account[]; accounts: Account[];
activitiesCount: number;
dateOfFirstActivity: Date; dateOfFirstActivity: Date;
id: string; id: string;
permissions: string[]; permissions: string[];

2
libs/common/src/lib/models/portfolio-snapshot.ts

@ -9,6 +9,8 @@ import { Big } from 'big.js';
import { Transform, Type } from 'class-transformer'; import { Transform, Type } from 'class-transformer';
export class PortfolioSnapshot { export class PortfolioSnapshot {
activitiesCount: number;
@Transform(transformToBig, { toClassOnly: true }) @Transform(transformToBig, { toClassOnly: true })
@Type(() => Big) @Type(() => Big)
currentValueInBaseCurrency: Big; currentValueInBaseCurrency: Big;

4
libs/ui/src/lib/value/value.component.html

@ -10,8 +10,8 @@
> >
<ng-container *ngIf="isNumber || value === null"> <ng-container *ngIf="isNumber || value === null">
<ng-container *ngIf="colorizeSign && !useAbsoluteValue"> <ng-container *ngIf="colorizeSign && !useAbsoluteValue">
<div *ngIf="value > 0" class="mr-1 text-success">+</div> <div *ngIf="+value > 0" class="mr-1 text-success">+</div>
<div *ngIf="value < 0" class="mr-1 text-danger">-</div> <div *ngIf="+value < 0" class="mr-1 text-danger">-</div>
</ng-container> </ng-container>
<div <div
*ngIf="isPercent" *ngIf="isPercent"

Loading…
Cancel
Save