feat(performance): investment performance vs Moscow Exchange index (WealthLedger/main#54) (#200)
Backend verify / commits (push) Skipped
Backend verify / security (push) Successful in 1m7s
Backend verify / verify (push) Failing after 7m19s

This commit was merged in pull request #200.
This commit is contained in:
2026-11-08 16:45:29 +03:00
parent 84433ee207
commit fee61537b6
28 changed files with 1507 additions and 4 deletions
@@ -11,6 +11,8 @@ import { toJson } from '#src/prisma/to-json';
import type { PortfolioDto } from '../presentation/portfolio.dto';
import { isCompleteValuation } from '../domain/complete-valuation';
const EXPECTED_UPDATED_ACCOUNTS = 1;
type PortfolioAttempt = {
@@ -140,10 +142,7 @@ export class PortfolioRepository {
});
// Value history points require a fully valued snapshot; the attempt
// identity deduplicates repeated or late publications of one attempt.
if (
snapshot.totalsByCurrency.length > Number.MIN_VALUE &&
snapshot.positions.every((position) => position.currentValue !== null)
) {
if (isCompleteValuation(snapshot)) {
await tx.tbankPortfolioValueHistory.upsert({
where: {
userId_accountId: { userId: attempt.userId, accountId },