Browse Source

NPM update, fixes & fix lint

pull/5027/head
Daniel Devaud 5 months ago
parent
commit
a79194cad8
  1. 55
      apps/api/src/app/portfolio/calculator/portfolio-calculator.ts
  2. 32
      apps/api/src/app/portfolio/portfolio.controller.ts
  3. 18
      apps/api/src/app/portfolio/portfolio.service.ts
  4. 4
      apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts
  5. 663
      package-lock.json
  6. 24
      package.json

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

@ -766,12 +766,6 @@ export abstract class PortfolioCalculator {
return { chart }; return { chart };
} }
public async getSnapshot() {
await this.snapshotPromise;
return this.snapshot;
}
public getStartDate() { public getStartDate() {
let firstAccountBalanceDate: Date; let firstAccountBalanceDate: Date;
let firstActivityDate: Date; let firstActivityDate: Date;
@ -797,24 +791,6 @@ export abstract class PortfolioCalculator {
return min([firstAccountBalanceDate, firstActivityDate]); return min([firstAccountBalanceDate, firstActivityDate]);
} }
protected abstract getSymbolMetrics({
chartDateMap,
dataSource,
end,
exchangeRates,
marketSymbolMap,
start,
symbol
}: {
chartDateMap: { [date: string]: boolean };
end: Date;
exchangeRates: { [dateString: string]: number };
marketSymbolMap: {
[date: string]: { [symbol: string]: Big };
};
start: Date;
} & AssetProfileIdentifier): SymbolMetrics;
public getTransactionPoints() { public getTransactionPoints() {
return this.transactionPoints; return this.transactionPoints;
} }
@ -1053,37 +1029,6 @@ export abstract class PortfolioCalculator {
} }
} }
public getStartDate() {
let firstAccountBalanceDate: Date;
let firstActivityDate: Date;
try {
const firstAccountBalanceDateString = first(
this.accountBalanceItems
)?.date;
firstAccountBalanceDate = firstAccountBalanceDateString
? parseDate(firstAccountBalanceDateString)
: new Date();
} catch (error) {
firstAccountBalanceDate = new Date();
}
try {
const firstActivityDateString = this.transactionPoints[0].date;
firstActivityDate = firstActivityDateString
? parseDate(firstActivityDateString)
: new Date();
} catch (error) {
firstActivityDate = new Date();
}
return min([firstAccountBalanceDate, firstActivityDate]);
}
public getTransactionPoints() {
return this.transactionPoints;
}
private getChartDateMap({ private getChartDateMap({
endDate, endDate,
startDate, startDate,

32
apps/api/src/app/portfolio/portfolio.controller.ts

@ -161,24 +161,22 @@ export class PortfolioController {
portfolioPosition.investment / totalInvestment; portfolioPosition.investment / totalInvestment;
portfolioPosition.valueInPercentage = portfolioPosition.valueInPercentage =
portfolioPosition.valueInBaseCurrency / totalValue; portfolioPosition.valueInBaseCurrency / totalValue;
(portfolioPosition.assetClass = hasDetails portfolioPosition.assetClass = hasDetails
? portfolioPosition.assetClass ? portfolioPosition.assetClass
: undefined), : undefined;
(portfolioPosition.assetSubClass = hasDetails portfolioPosition.assetSubClass = hasDetails
? portfolioPosition.assetSubClass ? portfolioPosition.assetSubClass
: undefined), : undefined;
(portfolioPosition.countries = hasDetails portfolioPosition.countries = hasDetails
? portfolioPosition.countries ? portfolioPosition.countries
: []), : [];
(portfolioPosition.currency = hasDetails portfolioPosition.currency = hasDetails
? portfolioPosition.currency ? portfolioPosition.currency
: undefined), : undefined;
(portfolioPosition.markets = hasDetails portfolioPosition.markets = hasDetails
? portfolioPosition.markets ? portfolioPosition.markets
: undefined), : undefined;
(portfolioPosition.sectors = hasDetails portfolioPosition.sectors = hasDetails ? portfolioPosition.sectors : [];
? portfolioPosition.sectors
: []);
} }
for (const [name, { valueInBaseCurrency }] of Object.entries(accounts)) { for (const [name, { valueInBaseCurrency }] of Object.entries(accounts)) {

18
apps/api/src/app/portfolio/portfolio.service.ts

@ -1714,24 +1714,6 @@ export class PortfolioService {
return { markets, marketsAdvanced }; return { markets, marketsAdvanced };
} }
private getReportStatistics(
evaluatedRules: PortfolioReportResponse['rules']
): PortfolioReportResponse['statistics'] {
const rulesActiveCount = Object.values(evaluatedRules)
.flat()
.filter((rule) => {
return rule?.isActive === true;
}).length;
const rulesFulfilledCount = Object.values(evaluatedRules)
.flat()
.filter((rule) => {
return rule?.value === true;
}).length;
return { rulesActiveCount, rulesFulfilledCount };
}
@LogPerformance @LogPerformance
private getReportStatistics( private getReportStatistics(
evaluatedRules: PortfolioReportResponse['rules'] evaluatedRules: PortfolioReportResponse['rules']

4
apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts

@ -219,8 +219,8 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
(this.activityForm.get('fee').value ?? 0); (this.activityForm.get('fee').value ?? 0);
} else if (this.activityForm.get('type').value === 'STAKE') { } else if (this.activityForm.get('type').value === 'STAKE') {
this.total = this.total =
this.activityForm.get('quantity').value * this.currentMarketPrice ?? this.activityForm.get('quantity').value *
0; (this.currentMarketPrice ?? 0);
} else { } else {
this.total = this.total =
this.activityForm.get('quantity').value * this.activityForm.get('quantity').value *

663
package-lock.json

File diff suppressed because it is too large

24
package.json

@ -156,17 +156,17 @@
"@eslint/js": "9.18.0", "@eslint/js": "9.18.0",
"@nestjs/schematics": "10.2.3", "@nestjs/schematics": "10.2.3",
"@nestjs/testing": "10.4.15", "@nestjs/testing": "10.4.15",
"@nx/angular": "20.3.2", "@nx/angular": "20.3.3",
"@nx/cypress": "20.3.2", "@nx/cypress": "20.3.3",
"@nx/eslint-plugin": "20.3.2", "@nx/eslint-plugin": "20.3.3",
"@nx/jest": "20.3.2", "@nx/jest": "20.3.3",
"@nx/js": "20.3.2", "@nx/js": "20.3.3",
"@nx/module-federation": "20.3.2", "@nx/module-federation": "20.3.3",
"@nx/nest": "20.3.2", "@nx/nest": "20.3.3",
"@nx/node": "20.3.2", "@nx/node": "20.3.3",
"@nx/storybook": "20.3.2", "@nx/storybook": "20.3.3",
"@nx/web": "20.3.2", "@nx/web": "20.3.3",
"@nx/workspace": "20.3.2", "@nx/workspace": "20.3.3",
"@schematics/angular": "19.0.6", "@schematics/angular": "19.0.6",
"@simplewebauthn/types": "9.0.1", "@simplewebauthn/types": "9.0.1",
"@storybook/addon-essentials": "8.4.7", "@storybook/addon-essentials": "8.4.7",
@ -196,7 +196,7 @@
"jest": "29.7.0", "jest": "29.7.0",
"jest-environment-jsdom": "29.7.0", "jest-environment-jsdom": "29.7.0",
"jest-preset-angular": "14.4.2", "jest-preset-angular": "14.4.2",
"nx": "20.3.2", "nx": "20.3.3",
"prettier": "3.4.2", "prettier": "3.4.2",
"prettier-plugin-organize-attributes": "1.0.0", "prettier-plugin-organize-attributes": "1.0.0",
"prisma": "6.2.1", "prisma": "6.2.1",

Loading…
Cancel
Save