From db4388779e2f072fd7574dc627e8a39c3aa4bf3f Mon Sep 17 00:00:00 2001 From: Matan Yadaev Date: Sun, 17 Nov 2024 16:47:25 +0200 Subject: [PATCH] feat: send failed reports to the manual review (#2843) --- .../useCreateBusinessReportBatchMutation.tsx | 3 --- .../useCreateBusinessReportMutation.tsx | 3 --- .../pages/MerchantMonitoring/MerchantMonitoring.page.tsx | 8 +++----- .../components/MerchantMonitoringTable/columns.tsx | 1 + .../useMerchantMonitoringBusinessReportLogic.tsx | 1 + services/workflows-service/prisma/data-migrations | 2 +- 6 files changed, 6 insertions(+), 12 deletions(-) diff --git a/apps/backoffice-v2/src/domains/business-reports/hooks/mutations/useCreateBusinessReportBatchMutation/useCreateBusinessReportBatchMutation.tsx b/apps/backoffice-v2/src/domains/business-reports/hooks/mutations/useCreateBusinessReportBatchMutation/useCreateBusinessReportBatchMutation.tsx index 841a4f888b..bf205b9000 100644 --- a/apps/backoffice-v2/src/domains/business-reports/hooks/mutations/useCreateBusinessReportBatchMutation/useCreateBusinessReportBatchMutation.tsx +++ b/apps/backoffice-v2/src/domains/business-reports/hooks/mutations/useCreateBusinessReportBatchMutation/useCreateBusinessReportBatchMutation.tsx @@ -29,9 +29,6 @@ export const useCreateBusinessReportBatchMutation = ({ merchantSheet, isExample: customer?.config?.isExample ?? false, }); - - // Artificial delay to ensure report is created in Unified API's DB - await new Promise(resolve => setTimeout(resolve, 3000)); }, onSuccess: data => { void queryClient.invalidateQueries(); diff --git a/apps/backoffice-v2/src/domains/business-reports/hooks/mutations/useCreateBusinessReportMutation/useCreateBusinessReportMutation.tsx b/apps/backoffice-v2/src/domains/business-reports/hooks/mutations/useCreateBusinessReportMutation/useCreateBusinessReportMutation.tsx index 2429f70c6a..b816ab61c3 100644 --- a/apps/backoffice-v2/src/domains/business-reports/hooks/mutations/useCreateBusinessReportMutation/useCreateBusinessReportMutation.tsx +++ b/apps/backoffice-v2/src/domains/business-reports/hooks/mutations/useCreateBusinessReportMutation/useCreateBusinessReportMutation.tsx @@ -43,9 +43,6 @@ export const useCreateBusinessReportMutation = ({ workflowVersion, isExample: customer?.config?.isExample ?? false, }); - - // Artificial delay to ensure report is created in Unified API's DB - await new Promise(resolve => setTimeout(resolve, 3000)); }, onSuccess: data => { if (customer?.config?.isExample) { diff --git a/apps/backoffice-v2/src/pages/MerchantMonitoring/MerchantMonitoring.page.tsx b/apps/backoffice-v2/src/pages/MerchantMonitoring/MerchantMonitoring.page.tsx index 130ddc8c59..77ef7582a3 100644 --- a/apps/backoffice-v2/src/pages/MerchantMonitoring/MerchantMonitoring.page.tsx +++ b/apps/backoffice-v2/src/pages/MerchantMonitoring/MerchantMonitoring.page.tsx @@ -90,11 +90,9 @@ export const MerchantMonitoring: FunctionComponent = () => { - {!!businessReports?.length && ( -
- -
- )} +
+ +
{isNonEmptyArray(businessReports) && } {Array.isArray(businessReports) && !businessReports.length && !isLoadingBusinessReports && ( diff --git a/apps/backoffice-v2/src/pages/MerchantMonitoring/components/MerchantMonitoringTable/columns.tsx b/apps/backoffice-v2/src/pages/MerchantMonitoring/components/MerchantMonitoringTable/columns.tsx index de80472b63..3ba4b15a7b 100644 --- a/apps/backoffice-v2/src/pages/MerchantMonitoring/components/MerchantMonitoringTable/columns.tsx +++ b/apps/backoffice-v2/src/pages/MerchantMonitoring/components/MerchantMonitoringTable/columns.tsx @@ -166,6 +166,7 @@ export const columns = [ {titleCase(statusToDisplayStatus[status as keyof typeof statusToDisplayStatus] ?? status)} diff --git a/apps/backoffice-v2/src/pages/MerchantMonitoringBusinessReport/hooks/useMerchantMonitoringBusinessReportLogic/useMerchantMonitoringBusinessReportLogic.tsx b/apps/backoffice-v2/src/pages/MerchantMonitoringBusinessReport/hooks/useMerchantMonitoringBusinessReportLogic/useMerchantMonitoringBusinessReportLogic.tsx index 29c67ec751..9b57afcb9c 100644 --- a/apps/backoffice-v2/src/pages/MerchantMonitoringBusinessReport/hooks/useMerchantMonitoringBusinessReportLogic/useMerchantMonitoringBusinessReportLogic.tsx +++ b/apps/backoffice-v2/src/pages/MerchantMonitoringBusinessReport/hooks/useMerchantMonitoringBusinessReportLogic/useMerchantMonitoringBusinessReportLogic.tsx @@ -62,6 +62,7 @@ export const useMerchantMonitoringBusinessReportLogic = () => { variant: 'violet', text: 'Quality Control', }, + [MERCHANT_REPORT_STATUSES_MAP['failed']]: { variant: 'destructive', text: 'Failed' }, } as const; const websiteWithNoProtocol = safeUrl(businessReport?.website)?.hostname; diff --git a/services/workflows-service/prisma/data-migrations b/services/workflows-service/prisma/data-migrations index a0c3055b4d..ce93f44f91 160000 --- a/services/workflows-service/prisma/data-migrations +++ b/services/workflows-service/prisma/data-migrations @@ -1 +1 @@ -Subproject commit a0c3055b4df212f7d4cf13a200593fe4de2ae909 +Subproject commit ce93f44f91051f3f875fc9ea6d04ef2b4d8c18cb