From 2779f04c937f30ce663d33f27db1766f17438ecc Mon Sep 17 00:00:00 2001 From: Omri Levy <61207713+Omri-Levy@users.noreply.github.com> Date: Thu, 16 May 2024 12:09:37 +0300 Subject: [PATCH] Demo environment (#2384) * feat(*): checkpoint * revert(workflows-service): reverted error log change * fix(backoffice-v2): associated companies fixes --- .../useUpdateDocumentByIdMutation.tsx | 5 +++++ .../useCaseBlocksLogic/utils/get-tabs-block-map.tsx | 1 - .../components/NoAlerts/NoAlerts.tsx | 2 +- pnpm-lock.yaml | 11 ++++++++--- services/workflows-service/package.json | 2 ++ services/workflows-service/prisma/data-migrations | 2 +- .../src/common/utils/winston-logger/winston-logger.ts | 2 +- services/workflows-service/src/types.ts | 4 ++++ .../src/workflow/hook-callback-handler.service.ts | 2 +- 9 files changed, 23 insertions(+), 8 deletions(-) diff --git a/apps/backoffice-v2/src/domains/workflows/hooks/mutations/useUpdateDocumentByIdMutation/useUpdateDocumentByIdMutation.tsx b/apps/backoffice-v2/src/domains/workflows/hooks/mutations/useUpdateDocumentByIdMutation/useUpdateDocumentByIdMutation.tsx index 70a9be4ee1..fa671ae335 100644 --- a/apps/backoffice-v2/src/domains/workflows/hooks/mutations/useUpdateDocumentByIdMutation/useUpdateDocumentByIdMutation.tsx +++ b/apps/backoffice-v2/src/domains/workflows/hooks/mutations/useUpdateDocumentByIdMutation/useUpdateDocumentByIdMutation.tsx @@ -41,6 +41,10 @@ export const useUpdateDocumentByIdMutation = ({ const previousWorkflow = queryClient.getQueryData(workflowById.queryKey); queryClient.setQueryData(workflowById.queryKey, (oldWorkflow: TWorkflowById) => { + if (!oldWorkflow) { + return; + } + return { ...oldWorkflow, context: { @@ -49,6 +53,7 @@ export const useUpdateDocumentByIdMutation = ({ if (doc.id === documentId) { return document; } + return doc; }), }, diff --git a/apps/backoffice-v2/src/lib/blocks/variants/DefaultBlocks/hooks/useCaseBlocksLogic/utils/get-tabs-block-map.tsx b/apps/backoffice-v2/src/lib/blocks/variants/DefaultBlocks/hooks/useCaseBlocksLogic/utils/get-tabs-block-map.tsx index 4450a1d0ff..d4b6766066 100644 --- a/apps/backoffice-v2/src/lib/blocks/variants/DefaultBlocks/hooks/useCaseBlocksLogic/utils/get-tabs-block-map.tsx +++ b/apps/backoffice-v2/src/lib/blocks/variants/DefaultBlocks/hooks/useCaseBlocksLogic/utils/get-tabs-block-map.tsx @@ -68,7 +68,6 @@ export const getTabsToBlocksMap = ( associated_companies: [ ...associatedCompaniesBlock, ...associatedCompaniesInformationBlock, - ...createKycBlocks(workflow as TWorkflowById), ...createAssociatedCompanyDocumentBlocks(workflow, blocksCreationParams), ], directors: [ diff --git a/apps/backoffice-v2/src/pages/TransactionMonitoringAlerts/components/NoAlerts/NoAlerts.tsx b/apps/backoffice-v2/src/pages/TransactionMonitoringAlerts/components/NoAlerts/NoAlerts.tsx index f1134ae17a..44f052f64e 100644 --- a/apps/backoffice-v2/src/pages/TransactionMonitoringAlerts/components/NoAlerts/NoAlerts.tsx +++ b/apps/backoffice-v2/src/pages/TransactionMonitoringAlerts/components/NoAlerts/NoAlerts.tsx @@ -3,7 +3,7 @@ import { FunctionComponent } from 'react'; export const NoAlerts: FunctionComponent = () => { return ( -
+
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3da8ef62a8..d703048209 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2607,6 +2607,9 @@ importers: '@types/jest': specifier: ^26.0.19 version: 26.0.24 + '@types/jmespath': + specifier: ^0.15.0 + version: 0.15.2 '@types/js-base64': specifier: ^3.3.1 version: 3.3.1 @@ -2679,6 +2682,9 @@ importers: jest-mock-extended: specifier: ^2.0.4 version: 2.0.9(jest@29.7.0)(typescript@4.9.3) + jmespath: + specifier: ^0.16.0 + version: 0.16.0 plop: specifier: ^4.0.0 version: 4.0.0 @@ -21065,7 +21071,7 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 5.62.0(eslint@8.54.0)(typescript@4.9.5) + '@typescript-eslint/parser': 5.62.0(eslint@8.54.0)(typescript@4.9.3) debug: 3.2.7 eslint: 8.54.0 eslint-import-resolver-node: 0.3.9 @@ -21230,7 +21236,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 5.62.0(eslint@8.54.0)(typescript@4.9.5) + '@typescript-eslint/parser': 5.62.0(eslint@8.54.0)(typescript@4.9.3) array-includes: 3.1.7 array.prototype.findlastindex: 1.2.3 array.prototype.flat: 1.3.2 @@ -25013,7 +25019,6 @@ packages: /jmespath@0.16.0: resolution: {integrity: sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw==} engines: {node: '>= 0.6.0'} - dev: false /joi@17.11.0: resolution: {integrity: sha512-NgB+lZLNoqISVy1rZocE9PZI36bL/77ie924Ri43yEvi9GUUMPeyVIr8KdFTMUlby1p0PBYMk9spIxEUQYqrJQ==} diff --git a/services/workflows-service/package.json b/services/workflows-service/package.json index 4c6abd52bc..c307d223ee 100644 --- a/services/workflows-service/package.json +++ b/services/workflows-service/package.json @@ -116,6 +116,7 @@ "@types/deep-diff": "^1.0.5", "@types/express": "4.17.9", "@types/jest": "^26.0.19", + "@types/jmespath": "^0.15.0", "@types/js-base64": "^3.3.1", "@types/json-stable-stringify": "^1.0.36", "@types/lodash": "^4.14.191", @@ -140,6 +141,7 @@ "eslint-plugin-import": "^2.27.5", "jest": "29.7.0", "jest-mock-extended": "^2.0.4", + "jmespath": "^0.16.0", "plop": "^4.0.0", "prettier": "^2.8.4", "prisma": "4.16.2", diff --git a/services/workflows-service/prisma/data-migrations b/services/workflows-service/prisma/data-migrations index d234189e59..618d172b50 160000 --- a/services/workflows-service/prisma/data-migrations +++ b/services/workflows-service/prisma/data-migrations @@ -1 +1 @@ -Subproject commit d234189e598cae9e57f34d565a35a2ec1cb3f8b5 +Subproject commit 618d172b5030221a03986ada2b4d0beda231a489 diff --git a/services/workflows-service/src/common/utils/winston-logger/winston-logger.ts b/services/workflows-service/src/common/utils/winston-logger/winston-logger.ts index ed943a4bc7..1cc1e85e5a 100644 --- a/services/workflows-service/src/common/utils/winston-logger/winston-logger.ts +++ b/services/workflows-service/src/common/utils/winston-logger/winston-logger.ts @@ -1,6 +1,6 @@ import { IAppLogger, LogPayload } from '@/common/abstract-logger/abstract-logger'; import { env } from '@/env'; -import { createLogger, format, transports, Logger as TWinstonLogger } from 'winston'; +import { createLogger, format, Logger as TWinstonLogger, transports } from 'winston'; export class WinstonLogger implements IAppLogger { private logger: TWinstonLogger; diff --git a/services/workflows-service/src/types.ts b/services/workflows-service/src/types.ts index e3551fb35a..452d55d13a 100644 --- a/services/workflows-service/src/types.ts +++ b/services/workflows-service/src/types.ts @@ -40,3 +40,7 @@ export type GenericFunction = (...args: AnyArray) => any; export type GenericAsyncFunction = (...args: AnyArray) => Promise; export type PrismaTransaction = Omit; + +export type PrismaTransactionMethod = Parameters[0]; + +export type PrismaTransactionClient = Parameters[0]; diff --git a/services/workflows-service/src/workflow/hook-callback-handler.service.ts b/services/workflows-service/src/workflow/hook-callback-handler.service.ts index ae2dd67dc0..2b85481fda 100644 --- a/services/workflows-service/src/workflow/hook-callback-handler.service.ts +++ b/services/workflows-service/src/workflow/hook-callback-handler.service.ts @@ -287,7 +287,7 @@ export class HookCallbackHandlerService { const customer = await this.customerService.getByProjectId(currentProjectId); const persistedDocuments = await this.workflowService.copyDocumentsPagesFilesAndCreate( documents as TDocumentsWithoutPageType, - // @ts-expect-error - we don't validate `context` is an object1 + // @ts-expect-error - we don't validate `context` is an object context.entity.id || context.entity.ballerineEntityId, currentProjectId, customer.name,