chore: strengthen backend eslint profile

This commit is contained in:
2026-09-28 11:04:18 +03:00
parent ca5dbcb382
commit 9b3558f96c
179 changed files with 4485 additions and 2716 deletions
@@ -1,13 +1,15 @@
import { Injectable } from '@nestjs/common';
import { createHash, randomUUID } from 'node:crypto';
import type { Prisma } from '../../../../generated/prisma/client';
import { PrismaService } from '../../../prisma/prisma.service';
import type { TbankSyncAttempt } from '../../../integrations/tbank/tbank.api';
import type { InvestmentScreenDto } from './tbank-sync.dto';
export type ScreenIntent = { scope: InvestmentScreenDto; now: string };
import { PrismaService } from '../../../prisma/prisma.service';
export type ScreenIntent = { now: string; scope: InvestmentScreenDto };
export type ScreenProgress = {
children: string[];
attempts?: Record<string, string>;
children: string[];
dispatched: boolean;
};
@Injectable()
@@ -38,8 +40,9 @@ export class TbankSyncRepository {
(await tx.tbankSyncWork.count({
where: { userId, revision, id: { in: children }, state: 'running' },
}))
)
) {
return { work: previous, launch: false };
}
}
const data = {
attemptId: randomUUID(),
@@ -60,6 +63,7 @@ export class TbankSyncRepository {
return { work, launch: true };
});
}
read(userId: string, revision: string, id: string) {
return this.prisma.$transaction(async (tx) => {
const work = await tx.tbankSyncWork.findFirst({
@@ -75,19 +79,20 @@ export class TbankSyncRepository {
work,
children: children.map((child) =>
progress.attempts?.[child.id] &&
progress.attempts[child.id] !== child.attemptId
? { ...child, state: 'cancelled', errorCode: null }
: child,
progress.attempts[child.id] !== child.attemptId ?
{ ...child, state: 'cancelled', errorCode: null } :
child,
),
progress,
};
});
}
async progress(
attempt: TbankSyncAttempt,
children: string[],
dispatched: boolean,
errorCode: string | null = null,
errorCode: null | string = null,
) {
return this.prisma.$transaction(async (tx) => {
const previous = await tx.tbankSyncWork.findFirst({ where: attempt });