diff --git a/eslint.config.mjs b/eslint.config.mjs index e453da7..5f33b10 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -56,6 +56,7 @@ export default defineConfig( 'after', { overrides: { '?': 'before', ':': 'before' } }, ], + 'import-x/no-cycle': 'error', 'import-x/no-duplicates': ['error', { 'prefer-inline': true }], }, }, diff --git a/src/modules/investments/operation-category.ts b/src/modules/investments/operation-category.ts new file mode 100644 index 0000000..8335697 --- /dev/null +++ b/src/modules/investments/operation-category.ts @@ -0,0 +1,10 @@ +export const operationCategories = [ + 'trade', + 'income', + 'tax', + 'fee', + 'transfer', + 'other', +] as const; + +export type OperationCategory = (typeof operationCategories)[number]; diff --git a/src/modules/investments/operations/infrastructure/brokerage-operation.mapper.ts b/src/modules/investments/operations/infrastructure/brokerage-operation.mapper.ts index 5d2a752..df9cf0b 100644 --- a/src/modules/investments/operations/infrastructure/brokerage-operation.mapper.ts +++ b/src/modules/investments/operations/infrastructure/brokerage-operation.mapper.ts @@ -3,10 +3,8 @@ import { MILLISECONDS_PER_SECOND } from '../../../../common/time'; import { decimal } from '../../../../integrations/tbank/decimal'; import { TbankOperationType } from '../../../../integrations/tbank/tbank-protocol'; import { TbankMoney, TbankOperationItem } from '../../../../integrations/tbank/tbank.api'; -import { - BrokerageOperationDto, - OperationCategory, -} from '../presentation/brokerage-operation.dto'; +import { type OperationCategory } from '../../operation-category'; +import { BrokerageOperationDto } from '../presentation/brokerage-operation.dto'; const MISSING_TIMESTAMP_COMPONENT = 0; diff --git a/src/modules/investments/operations/operations.api.ts b/src/modules/investments/operations/operations.api.ts index e197d9d..c26238c 100644 --- a/src/modules/investments/operations/operations.api.ts +++ b/src/modules/investments/operations/operations.api.ts @@ -5,4 +5,3 @@ export type { OperationInterval } from './domain/operations-sync-plan'; // Public cross-module surface. Nest providers are exported by the matching module. export { BrokerageOperationDto } from './presentation/brokerage-operation.dto'; -export { operationCategories } from './presentation/brokerage-operation.dto'; diff --git a/src/modules/investments/operations/presentation/brokerage-operation.dto.ts b/src/modules/investments/operations/presentation/brokerage-operation.dto.ts index c808477..c349c7d 100644 --- a/src/modules/investments/operations/presentation/brokerage-operation.dto.ts +++ b/src/modules/investments/operations/presentation/brokerage-operation.dto.ts @@ -16,6 +16,7 @@ import { import { MoneyDto } from '../../../../common/money.dto'; import { AccountReferenceDto } from '../../account-reference.dto'; import { InvestmentResourceMetaDto } from '../../investment-resource.dto'; +import { operationCategories, type OperationCategory } from '../../operation-category'; const MIN_OPERATIONS_PAGE_SIZE = 1; @@ -23,16 +24,6 @@ const MAX_CURSOR_LENGTH = 4096; const MAX_OPERATIONS_PAGE_SIZE = 1000; export const DEFAULT_OPERATIONS_PAGE_SIZE = 100; -export const operationCategories = [ - 'trade', - 'income', - 'tax', - 'fee', - 'transfer', - 'other', -] as const; -export type OperationCategory = (typeof operationCategories)[number]; - export class BrokerageOperationsQueryDto { @ApiPropertyOptional({ format: 'uuid', diff --git a/src/modules/investments/tbank-sync/tbank-sync.dto.ts b/src/modules/investments/tbank-sync/tbank-sync.dto.ts index cfb5d78..d3a28f7 100644 --- a/src/modules/investments/tbank-sync/tbank-sync.dto.ts +++ b/src/modules/investments/tbank-sync/tbank-sync.dto.ts @@ -23,7 +23,7 @@ import { import { MAX_INSTRUMENT_QUERY_LENGTH, MIN_INSTRUMENT_QUERY_LENGTH } from '../instrument-query'; import { InvestmentAttemptProblemDto } from '../investment-resource.dto'; -import { operationCategories } from '../operations/operations.api'; +import { operationCategories } from '../operation-category'; const MIN_ACCOUNT_ID_LENGTH = 1; const MIN_SYNC_PAGE_SIZE = 1;