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
@@ -20,6 +20,7 @@ import {
MinLength,
ValidateNested,
} from 'class-validator';
import { InvestmentResourceMetaDto } from '../investment-resource.dto';
import { operationCategories } from '../operations/operations.api';
@@ -46,12 +47,14 @@ export class InvestmentScreenDto {
@ApiProperty({ enum: investmentScreens })
@IsIn(investmentScreens)
declare screen: (typeof investmentScreens)[number];
@ApiPropertyOptional()
@IsOptional()
@IsString()
@MinLength(1)
@MaxLength(maxAccountIdLength)
accountId?: string;
@ApiPropertyOptional({
oneOf: [
{ type: 'string', format: 'date' },
@@ -61,6 +64,7 @@ export class InvestmentScreenDto {
@IsOptional()
@IsDateString({ strict: true })
from?: string;
@ApiPropertyOptional({
oneOf: [
{ type: 'string', format: 'date' },
@@ -70,30 +74,36 @@ export class InvestmentScreenDto {
@IsOptional()
@IsDateString({ strict: true })
to?: string;
@ApiPropertyOptional({ format: 'uuid' })
@IsOptional()
@IsUUID()
instrumentUid?: string;
@ApiPropertyOptional()
@IsOptional()
@IsString()
@MinLength(2)
@MaxLength(maxQueryLength)
query?: string;
@ApiPropertyOptional({ enum: ['month', 'halfYear', 'year', 'all'] })
@IsOptional()
@IsIn(['month', 'halfYear', 'year', 'all'])
candlePeriod?: 'month' | 'halfYear' | 'year' | 'all';
candlePeriod?: 'all' | 'halfYear' | 'month' | 'year';
@ApiPropertyOptional({ type: SyncCandleRangeDto })
@IsOptional()
@ValidateNested()
@Type(() => SyncCandleRangeDto)
candleRange?: SyncCandleRangeDto;
@ApiPropertyOptional({ enum: operationCategories, isArray: true })
@IsOptional()
@IsArray()
@IsIn(operationCategories, { each: true })
categories?: (typeof operationCategories)[number][];
@ApiPropertyOptional({ minimum: 1, maximum: maxPageSize })
@IsOptional()
@IsInt()
@@ -106,6 +116,7 @@ export class IncomeInvestmentScreenDto extends PickType(InvestmentScreenDto, [
'accountId',
]) {
@ApiProperty({ enum: ['income'] }) declare screen: 'income';
// eslint-disable-next-line @darraghor/nestjs-typed/api-property-matches-property-optionality -- Overrides optional metadata inherited through PickType.
@ApiProperty({ required: true }) declare accountId: string;
@ApiPropertyOptional({
format: 'date',
@@ -113,6 +124,7 @@ export class IncomeInvestmentScreenDto extends PickType(InvestmentScreenDto, [
'Inclusive start calendar date in Europe/Moscow (YYYY-MM-DD). Supply both from and to, or neither for the current Moscow month.',
})
from?: string;
@ApiPropertyOptional({
format: 'date',
description:
@@ -125,6 +137,7 @@ export class EventsInvestmentScreenDto extends PickType(InvestmentScreenDto, [
'accountId',
]) {
@ApiProperty({ enum: ['events'] }) declare screen: 'events';
// eslint-disable-next-line @darraghor/nestjs-typed/api-property-matches-property-optionality -- Overrides optional metadata inherited through PickType.
@ApiProperty({ required: true }) declare accountId: string;
@ApiPropertyOptional({
format: 'date',
@@ -132,6 +145,7 @@ export class EventsInvestmentScreenDto extends PickType(InvestmentScreenDto, [
'Inclusive UTC calendar start date (YYYY-MM-DD). May be supplied independently; defaults to today in UTC.',
})
from?: string;
@ApiPropertyOptional({
format: 'date',
description:
@@ -157,11 +171,13 @@ export class TimestampInvestmentScreenDto extends OmitType(
// The runtime validator retains legacy date-only inputs; the public contract uses instants.
@ApiProperty({ enum: timestampScreens })
declare screen: (typeof timestampScreens)[number];
@ApiPropertyOptional({
format: 'date-time',
description: 'Start instant for operations.',
})
from?: string;
@ApiPropertyOptional({
format: 'date-time',
description: 'End instant for operations.',
@@ -194,6 +210,7 @@ export class TbankSyncAcceptedDto {
@ApiProperty({ format: 'uuid' }) declare id: string;
@ApiProperty({ type: Object, ...investmentScreenSchema })
declare scope: InvestmentScreenDto;
@ApiProperty({ format: 'date-time' }) declare now: string;
}
export class TbankSyncProgressDto {
@@ -205,13 +222,17 @@ export class TbankSyncStatusDto {
@ApiProperty({ format: 'uuid' }) declare id: string;
@ApiProperty({ type: Object, ...investmentScreenSchema, nullable: true })
declare scope: InvestmentScreenDto | null;
@ApiProperty({ format: 'date-time' }) declare now: string;
@ApiProperty({ enum: ['running', 'succeeded', 'failed', 'cancelled'] })
declare state: 'running' | 'succeeded' | 'failed' | 'cancelled';
declare state: 'cancelled' | 'failed' | 'running' | 'succeeded';
@ApiProperty({ type: String, nullable: true }) declare errorCode:
string | null;
null | string;
@ApiProperty({ type: TbankSyncProgressDto })
declare progress: TbankSyncProgressDto;
@ApiProperty({ type: InvestmentResourceMetaDto, isArray: true })
declare resources: InvestmentResourceMetaDto[];
}