refactor!: support RUB only (WealthLedger/main#55)

Filter non-RUB data at ingest, collapse per-currency collections into single RUB Money, drop currency from TbankPortfolioValuePoint, remove NON_RUB_ACTIVITY and screener currency filter.

BREAKING CHANGE: per-currency API fields replaced with single RUB Money; stock screener currency param removed.
This commit is contained in:
2026-11-11 08:22:16 +03:00
parent fee61537b6
commit 3b55b611b5
60 changed files with 624 additions and 736 deletions
+7 -13
View File
@@ -16,18 +16,15 @@ describe('portfolio publication (SQLite)', () => {
const snapshot = {
lastSuccessfulAt: '2026-01-01T00:00:00.000Z',
isStale: false,
totalsByCurrency: [],
totals: { currency: 'RUB', value: '0' },
positions: [],
cashBalances: [],
structure: { currencies: [], unvaluedCategories: [] },
cash: { currency: 'RUB', value: '0' },
structure: { totalValue: '0', hasNegativeValues: false, categories: [], unvaluedCategories: [] },
} satisfies PortfolioDto;
const accountId = 'account';
const valuedSnapshot = {
...snapshot,
totalsByCurrency: [
{ currency: 'RUB', value: '200' },
{ currency: 'USD', value: '10' },
],
totals: { currency: 'RUB', value: '200' },
} satisfies PortfolioDto;
const createRunningAttempt = () =>
prisma.tbankSyncWork.create({
@@ -95,7 +92,7 @@ describe('portfolio publication (SQLite)', () => {
expect(await prisma.tbankPortfolio.count()).toBe(1);
});
it('rolls back the snapshot, first value point and claim when the second point fails', async () => {
it('rolls back the snapshot, value point and claim when the point write fails', async () => {
const previousFetchedAt = new Date('2025-12-31T00:00:00.000Z');
const previousCapturedAt = new Date('2025-12-31T01:00:00.000Z');
await prisma.tbankPortfolio.create({
@@ -114,7 +111,6 @@ describe('portfolio publication (SQLite)', () => {
points: {
create: {
attemptId: 'previous-attempt',
currency: 'RUB',
value: '100',
capturedAt: previousCapturedAt,
},
@@ -123,11 +119,9 @@ describe('portfolio publication (SQLite)', () => {
});
await createRunningAttempt();
interceptTransaction((tx) => {
const upsert = tx.tbankPortfolioValuePoint.upsert.bind(tx.tbankPortfolioValuePoint);
jest
.spyOn(tx.tbankPortfolioValuePoint, 'upsert')
.mockImplementationOnce((args) => upsert(args))
.mockRejectedValueOnce(new Error('injected second point failure'));
.mockRejectedValueOnce(new Error('injected point failure'));
});
await expect(
@@ -136,7 +130,7 @@ describe('portfolio publication (SQLite)', () => {
accountId,
valuedSnapshot,
),
).rejects.toThrow('injected second point failure');
).rejects.toThrow('injected point failure');
expect(
await prisma.tbankPortfolio.findUnique({