refactor: enforce enum machine codes

Use owner enums for error and T-Bank protocol values with ESLint regression checks.

Preserve open wire fallbacks and keep protocol imports independent of DI and Prisma.

Verified npm ci, verify, 226 unit tests, 262 isolated e2e tests and unchanged OpenAPI.
This commit is contained in:
2026-09-28 16:37:01 +03:00
committed by ksv741
parent 183b7f1efd
commit 33592c1d5f
47 changed files with 432 additions and 164 deletions
@@ -1,5 +1,6 @@
import { BadRequestException, Inject, Injectable } from '@nestjs/common';
import { HttpErrorCode } from '../../../common/error-code';
import {
supportedTbankAccounts,
TbankClient,
@@ -29,7 +30,7 @@ export class TbankConnectionService {
async put(userId: string, value: string) {
const token = value.trim();
if (!token) throw new BadRequestException({ code: 'VALIDATION_ERROR' });
if (!token) throw new BadRequestException({ code: HttpErrorCode.ValidationError });
const accounts = await this.tokens.translateInvalidToken(() =>
this.tbank.validateToken(token),
);