From 0f65ddbe880bb6e159e80dd0ebc79a2d0ad3f4f1 Mon Sep 17 00:00:00 2001 From: Tomer Shvadron Date: Sun, 13 Oct 2024 16:40:21 +0300 Subject: [PATCH] feat: not showing unfinished ongoing reports (#2773) --- .../business-report.controller.internal.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/services/workflows-service/src/business-report/business-report.controller.internal.ts b/services/workflows-service/src/business-report/business-report.controller.internal.ts index 7ffffb889..cbf90e5cf 100644 --- a/services/workflows-service/src/business-report/business-report.controller.internal.ts +++ b/services/workflows-service/src/business-report/business-report.controller.internal.ts @@ -20,7 +20,7 @@ import { ListBusinessReportsDto, ListBusinessReportsSchema, } from '@/business-report/list-business-reports.dto'; -import { Business, BusinessReportStatus, Prisma } from '@prisma/client'; +import { Business, BusinessReportStatus, BusinessReportType, Prisma } from '@prisma/client'; import { ZodValidationPipe } from '@/common/pipes/zod.pipe'; import { CreateBusinessReportDto } from '@/business-report/dto/create-business-report.dto'; import { @@ -239,6 +239,19 @@ export class BusinessReportControllerInternal { where: { businessId, batchId, + OR: [ + { + type: { + not: { + equals: BusinessReportType.ONGOING_MERCHANT_REPORT_T1, + }, + }, + }, + { + type: BusinessReportType.ONGOING_MERCHANT_REPORT_T1, + status: BusinessReportStatus.completed, + }, + ], ...(type ? { type } : {}), ...(search ? {