refactor: centralize domain values and enforce numeric lint

This commit is contained in:
2026-09-13 14:37:39 +03:00
parent 8ba005346d
commit 8637ad2f34
44 changed files with 543 additions and 174 deletions
@@ -11,6 +11,7 @@ import { rubMoney } from '../domain/rub-money';
import {
cardInput,
BankErrorCode,
conflict,
currentDate,
fail,
@@ -71,7 +72,7 @@ export class BankCardsService {
if (existing) {
if (existing.userId !== userId) missing();
if (existing.createFingerprint !== hash)
conflict('BANK_INTENT_CONFLICT');
conflict(BankErrorCode.IntentConflict);
return this.cardView(tx, existing);
}
currentDate(input.openingDate);
@@ -110,7 +111,8 @@ export class BankCardsService {
const financial =
input.openingBalanceKopecks !== previous.openingBalanceKopecks ||
input.openingDate !== previous.openingDate;
if (financial && previous.archivedAt) conflict('BANK_CARD_ARCHIVED');
if (financial && previous.archivedAt)
conflict(BankErrorCode.CardArchived);
currentDate(input.openingDate);
if (
await tx.bankCardOperation.findFirst({
@@ -122,7 +124,7 @@ export class BankCardsService {
},
})
)
fail('BANK_OPENING_DATE_CONFLICT');
fail(BankErrorCode.OpeningDateConflict);
const changed = await tx.bankCard.updateMany({
where: { id, userId, version: dto.version },
data: {