chore: strengthen backend eslint profile

This commit is contained in:
2026-09-28 16:37:01 +03:00
committed by ksv741
parent 53b2794963
commit a970eaaf7a
179 changed files with 4485 additions and 2716 deletions
@@ -1,10 +1,7 @@
import { CandleService } from '../../application/candle.service';
import type { TbankBond } from '../../../../../integrations/tbank/tbank.api';
import {
CatalogEnrichmentService,
type CatalogPayload,
} from '../../application/catalog-enrichment.service';
import { Injectable } from '@nestjs/common';
import type { TbankBond } from '../../../../../integrations/tbank/tbank.api';
import {
add,
decimalFromString,
@@ -14,15 +11,19 @@ import {
subtract,
} from '../../../../../common/decimal';
import { decimal } from '../../../../../integrations/tbank/decimal';
import { CandleService } from '../../application/candle.service';
import {
CatalogEnrichmentService,
type CatalogPayload,
} from '../../application/catalog-enrichment.service';
import { timestamp } from '../../application/instrument-market';
import { money } from '../infrastructure/bond-money.mapper';
import {
BondCandlesQueryDto,
BondQuoteDto,
BondQuoteResourceDto,
} from '../presentation/bond.dto';
import { money } from '../infrastructure/bond-money.mapper';
const PRICE_DECIMAL_PLACES = 9;
@Injectable()
export class BondMarketService {
@@ -30,6 +31,7 @@ export class BondMarketService {
private readonly history: CandleService,
private readonly sources: CatalogEnrichmentService,
) {}
async quote(
userId: string,
uid: string,
@@ -43,12 +45,13 @@ export class BondMarketService {
observe,
);
return {
data: result.values.instrument
? bondQuote(result.values, result.unavailable, result.observedAt)
: null,
data: result.values.instrument ?
bondQuote(result.values, result.unavailable, result.observedAt) :
null,
meta: result.meta,
};
}
candles(
userId: string,
uid: string,
@@ -77,8 +80,8 @@ export function bondQuote(
const cleanPrice =
pricePercent !== null &&
nominal &&
decimalFromString(nominal.value).value > 0n
? {
decimalFromString(nominal.value).value > 0n ?
{
currency: nominal.currency,
value: formatDecimal(
divide(
@@ -90,11 +93,11 @@ export function bondQuote(
PRICE_DECIMAL_PLACES,
),
),
}
: null;
} :
null;
const dirtyPrice =
cleanPrice && aci && aci.currency === cleanPrice.currency
? {
cleanPrice && aci && aci.currency === cleanPrice.currency ?
{
currency: cleanPrice.currency,
value: formatDecimal(
add(
@@ -102,8 +105,8 @@ export function bondQuote(
decimalFromString(aci.value),
),
),
}
: null;
} :
null;
return {
pricePercent,
cleanPrice,
@@ -112,9 +115,9 @@ export function bondQuote(
priceAt,
tradingStatus,
changePercentagePoints:
last?.price && previous?.close
? formatDecimal(subtract(decimal(last.price), decimal(previous.close)))
: null,
last?.price && previous?.close ?
formatDecimal(subtract(decimal(last.price), decimal(previous.close))) :
null,
previousCloseDate: timestamp(previous?.time)?.slice(0, 10) ?? null,
unavailable,
observedAt,