refactor: inject TbankAccessService directly into stock screener (#151) (#155)
Backend verify / commits (push) Skipped
Backend verify / security (push) Successful in 1m0s
Backend verify / verify (push) Failing after 6m12s

This commit was merged in pull request #155.
This commit is contained in:
2026-11-02 07:53:11 +03:00
parent a80bbbf1e2
commit 554410a271
4 changed files with 8 additions and 9 deletions
@@ -1,6 +1,5 @@
import {
BadRequestException,
Inject,
Injectable,
NotFoundException,
ServiceUnavailableException,
@@ -10,6 +9,7 @@ import { randomUUID } from 'node:crypto';
import type { TbankShare } from '../../../../../integrations/tbank/tbank-market.types';
import { StructuredLogger } from '../../../../../common/logging/structured-logger.service';
import { TbankAccessService } from '../../../../../integrations/tbank/tbank.api';
import { TbankClient } from '../../../../../integrations/tbank/tbank.client';
import {
selectStockScreenerInstruments,
@@ -47,17 +47,13 @@ type StockScreenerPage = {
searchId: string;
};
type Snapshot = { asOf: string; expiresAt: number; items: StockScreenerItem[]; revision: string; userId: string };
type TbankAccess = {
local(userId: string): Promise<{ revision: string }>;
online<T>(userId: string, run: (connection: { revision: string; token: string }) => Promise<T>): Promise<T>;
};
@Injectable()
export class StockScreenerService {
private readonly snapshots = new Map<string, Snapshot>();
constructor(
@Inject('TBANK_ACCESS') private readonly access: TbankAccess,
private readonly access: TbankAccessService,
private readonly client: TbankClient,
private readonly logger: StructuredLogger,
) {}