Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ongoing AML #2144

Merged
merged 29 commits into from
Mar 5, 2024
Merged

Ongoing AML #2144

merged 29 commits into from
Mar 5, 2024

Conversation

alonp99
Copy link
Collaborator

@alonp99 alonp99 commented Feb 29, 2024

User description

Description

Elaborate on the subject, motivation, and context.

Related issues

  • Provide a link to each related issue.

Breaking changes

  • Describe the breaking changes that this pull request introduces.

How these changes were tested

  • Describe the tests that you ran to verify your changes, including devices, operating systems, browsers and versions.

Examples and references

  • Links, screenshots, and other resources related to this change.

Checklist

  • [] I have read the contribution guidelines of this project
  • [] I have read the style guidelines of this project
  • [] I have performed a self-review of my own code
  • [] I have commented my code, particularly in hard-to-understand areas
  • [] I have made corresponding changes to the documentation
  • [] My changes generate no new warnings and errors
  • [] New and existing tests pass locally with my changes

Type

enhancement, bug_fix


Description

  • Added new actions (DISMISS, FLAG) for case management.
  • Implemented mutation hooks (useDismissCaseMutation, useFlagCaseMutation) for dismissing and flagging cases.
  • Refactored existing hooks and components to accommodate new case management actions.
  • Added OnGoingBlocks component and logic for handling ongoing cases.
  • Implemented ActionsVariant component to handle different action variants based on the workflow definition.
  • Added success and error toast messages for new actions.

Changes walkthrough

Relevant files
Enhancement
24 files
enums.ts
Add New Actions for Case Management                                           

apps/backoffice-v2/src/common/enums.ts

  • Added DISMISS and FLAG actions to the Action enum.
+2/-0     
useApproveCaseMutation.tsx
Refactor useApproveCaseMutation Hook Parameter Name           

apps/backoffice-v2/src/domains/entities/hooks/mutations/useApproveCaseMutation/useApproveCaseMutation.tsx

  • Changed parameter name from onSelectNextEntity to onSelectNextCase.
  • +2/-2     
    useDismissCaseMutation.tsx
    Implement Dismiss Case Mutation Hook                                         

    apps/backoffice-v2/src/domains/entities/hooks/mutations/useDismissCaseMutation/useDismissCaseMutation.tsx

    • Created useDismissCaseMutation hook for dismissing cases.
    +38/-0   
    useFlagCaseMutation.tsx
    Implement Flag Case Mutation Hook                                               

    apps/backoffice-v2/src/domains/entities/hooks/mutations/useFlagCaseMutation/useFlagCaseMutation.tsx

    • Created useFlagCaseMutation hook for flagging cases.
    +38/-0   
    useRejectCaseMutation.tsx
    Rename Reject Case Mutation Hook                                                 

    apps/backoffice-v2/src/domains/entities/hooks/mutations/useRejectCaseMutation/useRejectCaseMutation.tsx

    • Renamed useRejectEntityMutation to useRejectCaseMutation.
    +3/-3     
    useSelectNextCase.tsx
    Rename Select Next Case Hook                                                         

    apps/backoffice-v2/src/domains/entities/hooks/useSelectNextCase/useSelectNextCase.tsx

    • Renamed useSelectNextEntity to useSelectNextCase.
    +1/-1     
    fetchers.ts
    Add Mock Data for KYC Session AML Hits                                     

    apps/backoffice-v2/src/domains/workflows/fetchers.ts

    • Added mock data for KYC session with AML hits.
    +47/-0   
    useAmlBlock.tsx
    Implement AML Block Rendering Hook                                             

    apps/backoffice-v2/src/lib/blocks/components/AmlBlock/hooks/useAmlBlock/useAmlBlock.tsx

    • Implemented useAmlBlock hook for AML block rendering.
    +377/-0 
    aml-adapter.ts
    Add AML Data Adapter Utility Function                                       

    apps/backoffice-v2/src/lib/blocks/components/AmlBlock/utils/aml-adapter.ts

    • Added amlAdapter utility function for AML data adaptation.
    +81/-0   
    useKycBlock.tsx
    Refactor KYC Block to Use AML Block Hook                                 

    apps/backoffice-v2/src/lib/blocks/components/KycBlock/hooks/useKycBlock/useKycBlock.tsx

    • Refactored to use useAmlBlock hook.
    +12/-432
    NoBlocks.tsx
    Adjust Padding for NoBlocks Component                                       

    apps/backoffice-v2/src/lib/blocks/components/NoBlocks/NoBlocks.tsx

    • Adjusted padding for the NoBlocks component.
    +1/-1     
    BlocksVariant.tsx
    Add Handling for Ongoing Variant in BlocksVariant               

    apps/backoffice-v2/src/lib/blocks/variants/BlocksVariant/BlocksVariant.tsx

    • Added handling for the ONGOING variant.
    +7/-0     
    OnGoingBlocks.tsx
    Implement OnGoingBlocks Component                                               

    apps/backoffice-v2/src/lib/blocks/variants/OnGoingBlocks/OnGoingBlocks.tsx

    • Implemented OnGoingBlocks component for ongoing cases.
    +17/-0   
    useOnGoingBlocksLogic.tsx
    Implement Logic Hook for OnGoingBlocks Component                 

    apps/backoffice-v2/src/lib/blocks/variants/OnGoingBlocks/hooks/useOnGoingBlocksLogic/useOnGoingBlocksLogic.tsx

    • Implemented logic hook for OnGoingBlocks component.
    +47/-0   
    variant-checkers.ts
    Add Checker Function for Ongoing Variant                                 

    apps/backoffice-v2/src/lib/blocks/variants/variant-checkers.ts

    • Added checker function for ONGOING variant.
    +6/-0     
    Case.Actions.tsx
    Refactor Case Actions to Use ActionsVariant Component       

    apps/backoffice-v2/src/pages/Entity/components/Case/Case.Actions.tsx

    • Refactored to use ActionsVariant component.
    +10/-88 
    ActionsVariant.tsx
    Implement ActionsVariant Component                                             

    apps/backoffice-v2/src/pages/Entity/components/Case/actions-variants/ActionsVariant/ActionsVariant.tsx

  • Implemented ActionsVariant component for handling different action
    variants.
  • +17/-0   
    DefaultActions.tsx
    Implement DefaultActions Component                                             

    apps/backoffice-v2/src/pages/Entity/components/Case/actions-variants/DefaultActions/DefaultActions.tsx

    • Implemented DefaultActions component for default case actions.
    +98/-0   
    useDefaultActionsLogic.tsx
    Implement Logic Hook for DefaultActions Component               

    apps/backoffice-v2/src/pages/Entity/components/Case/actions-variants/DefaultActions/hooks/useDefaultActionsLogic/useDefaultActionsLogic.tsx

    • Implemented logic hook for DefaultActions component.
    +82/-0   
    OnGoingActions.tsx
    Implement OnGoingActions Component                                             

    apps/backoffice-v2/src/pages/Entity/components/Case/actions-variants/OnGoingActions/OnGoingActions.tsx

    • Implemented OnGoingActions component for ongoing case actions.
    +110/-0 
    useOnGoingActionsLogic.tsx
    Implement Logic Hook for OnGoingActions Component               

    apps/backoffice-v2/src/pages/Entity/components/Case/actions-variants/OnGoingActions/hooks/useOnGoingActionsLogic/useOnGoingActionsLogic.tsx

    • Implemented logic hook for OnGoingActions component.
    +64/-0   
    useCaseActionsLogic.tsx
    Refactor Case Actions Logic and Add Workflow Definition   

    apps/backoffice-v2/src/pages/Entity/components/Case/hooks/useCaseActionsLogic/useCaseActionsLogic.tsx

  • Refactored to remove unused imports and logic.
  • Added workflowDefinition to the return object.
  • +1/-45   
    index.ts
    Add Ongoing Variant to WorkflowDefinitionVariant                 

    packages/common/src/consts/index.ts

    • Added ONGOING to WorkflowDefinitionVariant.
    +1/-0     
    toast.json
    Add Toast Messages for Dismiss and Flag Actions                   

    apps/backoffice-v2/public/locales/en/toast.json

  • Added success and error messages for dismissing and flagging cases.
  • +8/-0     

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    tomer-shvadron and others added 23 commits February 27, 2024 00:05
    …eset:dev script before running db:data-migration:migrate
    
    fix(prisma): update subproject commit hash in data-migrations
    
    feat(prisma): add config column to Customer table
    
    feat(app.module): import WebhooksModule
    
    feat(zod-schemas): add CustomerConfigSchema and TCustomerConfig types
    
    fix(end-user.repository): update import path for PrismaService
    
    feat(end-user.service): add missing line break
    
    fix(filter.repository): update scopeService.scopeFindFirst method call
    
    fix(global.d.ts): add config and subscriptions fields to Customer type
    
    feat(webhooks): add AmlWebhookInput and IndividualAmlWebhookInput DTOs
    
    feat(webhooks): add webhooks controller, module, and service
    
    - Add a new file `webhooks.controller.ts` to handle webhooks related requests.
    - Add a new file `webhooks.module.ts` to define the webhooks module and its dependencies.
    - Add a new file `webhooks.service.ts` to handle webhook events.
    - Implement the `amlHook` method in the `WebhooksController` to handle AML webhook events.
    - Implement the `handleAmlHit` method in the `WebhooksService` to handle AML_HIT events.
    - Update the imports and dependencies in the existing files to include the newly added files.
    
    The purpose of these changes is to introduce a new feature that allows handling AML webhook events in the application. This feature will enable the application to respond to AML_HIT events and perform necessary actions based on the event data.
    …eset:dev script before running db:data-migration:migrate
    
    chore(package.json): add new migration script for adding a config column to the Customer table
    
    chore(schema.prisma): add config field to the Customer model
    
    chore(app.module.ts): import and add WebhooksModule to the AppModule
    
    chore(zod-schemas.ts): add CustomerConfigSchema and TCustomerConfig types
    
    chore(end-user.repository.ts): update import path for PrismaService
    
    chore(end-user.repository.ts): add new method findByIdUnscoped to retrieve end user by id without applying project scope
    
    chore(end-user.service.ts): add missing line break
    
    chore(filter.repository.ts): update scopeService.scopeFindFirst to scopeService.scopeFindFirst with projectIds parameter
    
    chore(global.d.ts): add config field to the Customer type
    
    chore(webhooks/dtos/aml-webhook-input.ts): create AmlWebhookInput class
    
    chore(webhooks/dtos/individual-aml-webhook-input.ts): create IndividualAmlWebhookInput class
    
    feat(webhooks): add webhooks controller, module, and service
    
    - Add a new file `webhooks.controller.ts` to handle webhooks related requests.
    - Add a new file `webhooks.module.ts` to define the webhooks module and its dependencies.
    - Add a new file `webhooks.service.ts` to handle webhook events.
    - Implement the `amlHook` method in the `WebhooksController` to handle AML webhook events.
    - Implement the `handleAmlHit` method in the `WebhooksService` to handle AML_HIT events.
    - Update the imports and dependencies in the existing files to include the newly added files.
    
    The purpose of these changes is to introduce a new feature that allows handling AML webhook events in the application. This feature will enable the application to respond to AML_HIT events and perform necessary actions based on the event data.
    …eset:dev script before running db:data-migration:migrate
    
    fix(prisma): update subproject commit hash in data-migrations
    
    feat(prisma): add config column to Customer table
    
    feat(app.module): import WebhooksModule
    
    feat(zod-schemas): add CustomerConfigSchema and TCustomerConfig types
    
    fix(end-user.repository): update import path for PrismaService
    
    feat(end-user.service): add missing line break
    
    fix(filter.repository): update scopeService.scopeFindFirst method call
    
    fix(global.d.ts): add config and subscriptions fields to Customer type
    
    feat(webhooks): add AmlWebhookInput and IndividualAmlWebhookInput DTOs
    
    feat(webhooks): add webhooks controller, module, and service
    
    - Add a new file `webhooks.controller.ts` to handle webhooks related requests.
    - Add a new file `webhooks.module.ts` to define the webhooks module and its dependencies.
    - Add a new file `webhooks.service.ts` to handle webhook events.
    - Implement the `amlHook` method in the `WebhooksController` to handle AML webhook events.
    - Implement the `handleAmlHit` method in the `WebhooksService` to handle AML_HIT events.
    - Update the imports and dependencies in the existing files to include the newly added files.
    
    The purpose of these changes is to introduce a new feature that allows handling AML webhook events in the application. This feature will enable the application to respond to AML_HIT events and perform necessary actions based on the event data.
    …tions
    
    refactor(business.controller.internal): remove unused import of ProjectScopeService
    fix(customer.repository): fix import path for PrismaService
    test(workflow-definition.service.intg.test): update filterService.getById calls to pass correct project id argument
    …tions
    
    refactor(business.controller.internal): remove unused import of ProjectScopeService
    fix(customer.repository): fix import path for PrismaService
    test(workflow-definition.service.intg.test): update filterService.getById calls to pass correct project id parameter
    …tions
    
    refactor(business.controller.internal): remove unused import of ProjectScopeService
    fix(customer.repository): fix import path for PrismaService
    test(workflow-definition.service.intg.test): update filterService.getById calls to pass correct project id argument
    Copy link

    changeset-bot bot commented Feb 29, 2024

    ⚠️ No Changeset found

    Latest commit: 2a58b49

    Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

    This PR includes no changesets

    When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

    Click here to learn what changesets are, and how to add one.

    Click here if you're a maintainer who wants to add a changeset to this PR

    @github-actions github-actions bot added enhancement New feature or request bug_fix labels Feb 29, 2024
    Copy link
    Contributor

    PR Description updated to latest commit (a14ce74)

    Copy link
    Contributor

    PR Review

    ⏱️ Estimated effort to review [1-5]

    3, because the PR introduces new functionality across multiple files, including backend logic for handling new case management actions (DISMISS, FLAG), mutation hooks, and components for ongoing cases. It also involves changes to enums, services, and introduces new webhooks handling. The complexity of these changes and their impact across different parts of the application increases the review effort.

    🧪 Relevant tests

    No

    🔍 Possible issues

    The useDismissCaseMutation and useFlagCaseMutation hooks do not seem to re-implement the onSelectNextCase callback after successful mutation. This might lead to unexpected behavior in the UI where the next case is not automatically selected upon dismissing or flagging a case.

    The amlAdapter function in useAmlBlock hook is directly imported and used, which might not be the best practice. Consider moving this utility function to a more appropriate location or ensuring it's part of a service.

    The useOnGoingBlocksLogic hook directly accesses the config property of a customer to get ongoingWorkflowDefinitionId. This could lead to runtime errors if config is null or does not contain the expected property. It's safer to add checks or use optional chaining.

    The webhooks.controller.ts does not validate the entityType parameter against expected values before proceeding with the logic in amlHook. This might lead to unintended behavior if an unexpected entityType is received.

    🔒 Security concerns

    No

    Code feedback:
    relevant fileapps/backoffice-v2/src/domains/entities/hooks/mutations/useDismissCaseMutation/useDismissCaseMutation.tsx
    suggestion      

    Consider re-implementing the onSelectNextCase callback after a successful mutation to ensure the UI behaves as expected, moving to the next case automatically. [important]

    relevant line// TODO: Re-implement

    relevant fileapps/backoffice-v2/src/lib/blocks/components/AmlBlock/hooks/useAmlBlock/useAmlBlock.tsx
    suggestion      

    Evaluate if amlAdapter should be part of a service or utility file rather than being directly imported into the hook, to follow best practices for code organization and reusability. [medium]

    relevant lineimport { amlAdapter } from '@/lib/blocks/components/AmlBlock/utils/aml-adapter';

    relevant fileapps/backoffice-v2/src/lib/blocks/variants/OnGoingBlocks/hooks/useOnGoingBlocksLogic/useOnGoingBlocksLogic.tsx
    suggestion      

    Add checks or use optional chaining for accessing config.ongoingWorkflowDefinitionId to avoid potential runtime errors. [important]

    relevant lineif (!config?.ongoingWorkflowDefinitionId) {

    relevant fileapps/backoffice-v2/src/webhooks/webhooks.controller.ts
    suggestion      

    Validate entityType against expected values (e.g., BUSINESS, INDIVIDUALS) in amlHook to ensure the logic is executed only for supported entity types. [medium]

    relevant lineif (entityType === ENTITY_TYPES.INDIVIDUALS) {


    ✨ Review tool usage guide:

    Overview:
    The review tool scans the PR code changes, and generates a PR review. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.
    When commenting, to edit configurations related to the review tool (pr_reviewer section), use the following template:

    /review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=...
    

    With a configuration file, use the following template:

    [pr_reviewer]
    some_config1=...
    some_config2=...
    
    Utilizing extra instructions

    The review tool can be configured with extra instructions, which can be used to guide the model to a feedback tailored to the needs of your project.

    Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify the relevant sub-tool, and the relevant aspects of the PR that you want to emphasize.

    Examples for extra instructions:

    [pr_reviewer] # /review #
    extra_instructions="""
    In the 'possible issues' section, emphasize the following:
    - Does the code logic cover relevant edge cases?
    - Is the code logic clear and easy to understand?
    - Is the code logic efficient?
    ...
    """
    

    Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.

    How to enable\disable automation
    • When you first install PR-Agent app, the default mode for the review tool is:
    pr_commands = ["/review", ...]
    

    meaning the review tool will run automatically on every PR, with the default configuration.
    Edit this field to enable/disable the tool, or to change the used configurations

    Auto-labels

    The review tool can auto-generate two specific types of labels for a PR:

    • a possible security issue label, that detects possible security issues (enable_review_labels_security flag)
    • a Review effort [1-5]: x label, where x is the estimated effort to review the PR (enable_review_labels_effort flag)
    Extra sub-tools

    The review tool provides a collection of possible feedbacks about a PR.
    It is recommended to review the possible options, and choose the ones relevant for your use case.
    Some of the feature that are disabled by default are quite useful, and should be considered for enabling. For example:
    require_score_review, require_soc2_ticket, and more.

    Auto-approve PRs

    By invoking:

    /review auto_approve
    

    The tool will automatically approve the PR, and add a comment with the approval.

    To ensure safety, the auto-approval feature is disabled by default. To enable auto-approval, you need to actively set in a pre-defined configuration file the following:

    [pr_reviewer]
    enable_auto_approval = true
    

    (this specific flag cannot be set with a command line argument, only in the configuration file, committed to the repository)

    You can also enable auto-approval only if the PR meets certain requirements, such as that the estimated_review_effort is equal or below a certain threshold, by adjusting the flag:

    [pr_reviewer]
    maximal_review_effort = 5
    
    More PR-Agent commands

    To invoke the PR-Agent, add a comment using one of the following commands:

    • /review: Request a review of your Pull Request.
    • /describe: Update the PR title and description based on the contents of the PR.
    • /improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
    • /ask <QUESTION>: Ask a question about the PR.
    • /update_changelog: Update the changelog based on the PR's contents.
    • /add_docs 💎: Generate docstring for new components introduced in the PR.
    • /generate_labels 💎: Generate labels for the PR based on the PR's contents.
    • /analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

    See the tools guide for more details.
    To list the possible configuration parameters, add a /config comment.

    See the review usage page for a comprehensive guide on using this tool.

    Copy link
    Contributor

    github-actions bot commented Feb 29, 2024

    PR Code Suggestions

    CategorySuggestions                                                                                                                                                       
    Maintainability
    Convert enum properties to uppercase for consistency.

    Consider using a consistent naming convention for enum properties. The existing enum
    properties are in uppercase, but 'DISMISS' and 'FLAG' are in lowercase. To maintain
    consistency and readability, it's recommended to convert them to uppercase.

    apps/backoffice-v2/src/common/enums.ts [43-44]

    -DISMISS: 'dismiss',
    -FLAG: 'flag',
    +DISMISS: 'DISMISS',
    +FLAG: 'FLAG',
     
    Break down large object structures for better readability.

    For better maintainability and readability, consider breaking down the large object
    structure into smaller functions or constants. This can help in isolating specific parts
    of the data structure, making it easier to read and maintain.

    apps/backoffice-v2/src/domains/workflows/fetchers.ts [144-190]

    +const kycSessionData = {
    +  aml: {
    +    hits: [
    +      {
    +        matchedName: 'John Doe',
    +        ...
     kyc_session: {
    -  kyc_session_1: {
    -    aml: {
    -      hits: [
    -        {
    -          matchedName: 'John Doe',
    -          ...
    +  kyc_session_1: kycSessionData,
     
    Use a factory pattern or mapping object for handling variant components.

    To ensure scalability and maintainability, consider implementing a factory pattern or a
    mapping object for variant components instead of using multiple if statements. This
    approach simplifies adding new variants in the future.

    apps/backoffice-v2/src/lib/blocks/variants/BlocksVariant/BlocksVariant.tsx [20-30]

    -if (isKybExampleVariant) {
    -  return <KybExampleBlocks />;
    -}
    -if (isManualReviewVariant) {
    -  return <ManualReviewBlocks />;
    -}
    -if (isOnGoingVariant) {
    -  return <OnGoingBlocks />;
    -}
    +const variantMapping = {
    +  kybExample: KybExampleBlocks,
    +  manualReview: ManualReviewBlocks,
    +  onGoing: OnGoingBlocks,
    +};
    +const VariantComponent = variantMapping[workflowDefinition.variant];
    +return VariantComponent ? <VariantComponent /> : <DefaultBlocks />;
     
    Reduce code duplication by extracting repeated logic into a reusable component.

    Extract the repeated Dialog component logic into a reusable component to reduce code
    duplication and improve maintainability.

    apps/backoffice-v2/src/pages/Entity/components/Case/actions-variants/DefaultActions/DefaultActions.tsx [33-72]

    -<Dialog>
    -  <DialogTrigger asChild>
    -    <Button
    -      size="md"
    -      variant="warning"
    -      disabled={isLoadingActions || !canRevision}
    -      className={ctw({ loading: debouncedIsLoadingRejectCase })}
    -    >
    -      Ask for all re-uploads {canRevision && `(${documentsToReviseCount})`}
    -    </Button>
    -  </DialogTrigger>
    -  ...
    -</Dialog>
    +<CustomDialog
    +  buttonSize="md"
    +  buttonVariant="warning"
    +  isLoading={isLoadingActions}
    +  isDisabled={!canRevision}
    +  loadingClass={debouncedIsLoadingRejectCase}
    +  dialogTitle="Ask for all re-uploads"
    +  dialogDescription="By clicking the button below, an email with a link will be sent to the customer, directing them to re-upload the documents you have marked as “re-upload needed”."
    +/>
     
    Enhancement
    Improve error handling by displaying specific error messages.

    To improve error handling, consider providing more detailed error information in the
    onError callback of the useMutation hook. This can be achieved by using the error
    parameter provided by React Query to display a more specific error message.

    apps/backoffice-v2/src/domains/entities/hooks/mutations/useDismissCaseMutation/useDismissCaseMutation.tsx [34-35]

    -onError: () => {
    -  toast.error(t('toast:dismiss_case.error'));
    +onError: (error) => {
    +  toast.error(t('toast:dismiss_case.error') + ': ' + error.message);
     },
     
    Implement a fallback UI for empty AML data.

    To enhance the user experience, consider implementing a fallback UI component or message
    for the case when AML data is empty. This can inform users that no data is available
    instead of showing an empty state.

    apps/backoffice-v2/src/lib/blocks/components/AmlBlock/hooks/useAmlBlock/useAmlBlock.tsx [363-364]

     if (isAmlEmpty) {
    -  return [];
    +  return [<p>No AML data available.</p>];
     }
     
    Simplify code by destructuring function parameters.

    Consider destructuring workflowDefinition directly in the function parameters to simplify
    the code and improve readability.

    apps/backoffice-v2/src/pages/Entity/components/Case/actions-variants/ActionsVariant/ActionsVariant.tsx [7-9]

     export const ActionsVariant: FunctionComponent<{
       workflowDefinition: Pick<TWorkflowById['workflowDefinition'], 'variant' | 'config' | 'version'>;
    -}> = ({ workflowDefinition }) => {
    +}> = ({ workflowDefinition: { variant, config, version } }) => {
     
    Simplify loading state checks by combining them.

    Combine the loading state checks into a single variable to simplify the conditionals in
    your component.

    apps/backoffice-v2/src/pages/Entity/components/Case/actions-variants/OnGoingActions/hooks/useOnGoingActionsLogic/useOnGoingActionsLogic.tsx [45]

    -const isLoadingActions = isLoadingDismissCase || isLoadingFlagCase || isLoadingAssignWorkflow;
    +const isLoadingAnyAction = [isLoadingDismissCase, isLoadingFlagCase, isLoadingAssignWorkflow].some(isLoading => isLoading);
     
    Improve code readability by destructuring objects.

    Consider destructuring workflow object to improve code readability.

    apps/backoffice-v2/src/pages/Entity/components/Case/hooks/useCaseActionsLogic/useCaseActionsLogic.tsx [52-54]

    -const assignedUser = workflow?.assignee
    +const { assignee } = workflow;
    +const assignedUser = assignee
       ? {
    -      id: workflow?.assignee?.id,
    +      id: assignee.id,
     
    Best practice
    Add type annotations for the return value of amlAdapter.

    Consider adding type annotations for the return value of the amlAdapter function. This can
    improve code readability and make it easier for developers to understand the structure of
    the data being returned.

    apps/backoffice-v2/src/lib/blocks/components/AmlBlock/utils/aml-adapter.ts [35]

    -export const amlAdapter = (aml: IAmlAdapterParams) => {
    +interface AmlAdapterReturn {
    +  totalMatches: number;
    +  fullReport: object;
    +  dateOfCheck: string;
    +  matches: Array<object>;
    +}
     
    +export const amlAdapter = (aml: IAmlAdapterParams): AmlAdapterReturn => {
    +
    Use Tailwind CSS's spacing classes for consistent and maintainable styling.

    For consistency and maintainability, consider using Tailwind CSS's spacing classes
    (space-x-, space-y-) instead of individual padding and margin classes for elements
    within a flex or grid container.

    apps/backoffice-v2/src/lib/blocks/components/NoBlocks/NoBlocks.tsx [5]

    -<div className="flex items-center justify-center border-l-[1px] p-4 pb-72">
    +<div className="flex items-center justify-center border-l-[1px] p-4 space-y-18">
     
    Improve variable naming for better readability.

    Use a more descriptive variable name than canFlag and canDismiss to improve code
    readability and maintainability.

    apps/backoffice-v2/src/pages/Entity/components/Case/actions-variants/OnGoingActions/OnGoingActions.tsx [26-29]

    -const canDismiss =
    +const isDismissEnabled =
       caseState.actionButtonsEnabled && workflow?.nextEvents?.includes(Action.DISMISS);
    -const canFlag = caseState.actionButtonsEnabled && workflow?.nextEvents?.includes(Action.FLAG);
    +const isFlagEnabled = caseState.actionButtonsEnabled && workflow?.nextEvents?.includes(Action.FLAG);
     
    Simplify object property assignment with optional chaining and nullish coalescing.

    Use optional chaining and nullish coalescing operator to simplify the assignment of
    assignedUser.

    apps/backoffice-v2/src/pages/Entity/components/Case/hooks/useCaseActionsLogic/useCaseActionsLogic.tsx [52-54]

    -const assignedUser = workflow?.assignee
    -  ? {
    -      id: workflow?.assignee?.id,
    +const assignedUser = workflow?.assignee?.id ? { id: workflow.assignee.id } : undefined;
     
    Simplify function declaration by removing unnecessary useCallback.

    Replace useCallback with a simpler function declaration when dependencies are not
    specified or needed.

    apps/backoffice-v2/src/pages/Entity/components/Case/hooks/useCaseActionsLogic/useCaseActionsLogic.tsx [37-39]

    -const onMutateAssignWorkflow = useCallback(
    -  (assigneeId: string, isAssignedToMe: boolean) =>
    -    mutateAssignWorkflow({
    +const onMutateAssignWorkflow = (assigneeId: string, isAssignedToMe: boolean) =>
    +  mutateAssignWorkflow({
     
    Performance
    Memoize the amlBlock component to prevent unnecessary re-renders.

    Consider memoizing the amlBlock component using useMemo to avoid unnecessary re-renders.
    This is particularly useful if the amlBlock component is complex or if its props are
    likely to change frequently.

    apps/backoffice-v2/src/lib/blocks/components/KycBlock/hooks/useKycBlock/useKycBlock.tsx [107-110]

    -const amlBlock = useAmlBlock({
    +const amlBlock = useMemo(() => useAmlBlock({
       sessionKeys: kycSessionKeys,
       getAmlData,
    -});
    +}), [kycSessionKeys, getAmlData]);
     
    Memoize the blocks array to optimize performance.

    To optimize performance, consider memoizing the blocks array using useMemo to prevent
    unnecessary recalculations and re-renders when the dependencies have not changed.

    apps/backoffice-v2/src/lib/blocks/variants/OnGoingBlocks/hooks/useOnGoingBlocksLogic/useOnGoingBlocksLogic.tsx [39-41]

    -const blocks = useMemo(() => {
    -  return [...amlWithContainerBlock];
    -}, [amlWithContainerBlock]);
    +const blocks = useMemo(() => [...amlWithContainerBlock], [amlWithContainerBlock]);
     
    Use useMemo to prevent unnecessary re-renders.

    Consider memoizing the assignedUser object to avoid unnecessary re-renders.

    apps/backoffice-v2/src/pages/Entity/components/Case/hooks/useCaseActionsLogic/useCaseActionsLogic.tsx [52-54]

    -const assignedUser = workflow?.assignee
    -  ? {
    -      id: workflow?.assignee?.id,
    +const assignedUser = useMemo(() => workflow?.assignee ? { id: workflow.assignee.id } : undefined, [workflow?.assignee]);
     
    Accessibility
    Add aria-labels to improve accessibility for screen reader users.

    Ensure accessibility by adding meaningful aria-labels to interactive elements or
    components that lack textual content. This improves the experience for users relying on
    screen readers.

    apps/backoffice-v2/src/lib/blocks/variants/OnGoingBlocks/OnGoingBlocks.tsx [11-12]

    -<BlocksComponent blocks={blocks} cells={cells}>
    +<BlocksComponent blocks={blocks} cells={cells} aria-label="Ongoing Blocks">
       {(Cell, cell) => <Cell {...cell} />}
     </BlocksComponent>
     
    Possible issue
    Add a check to ensure workflowDefinition is defined before usage.

    Ensure that workflowDefinition is always defined before rendering ActionsVariant to avoid
    potential runtime errors.

    apps/backoffice-v2/src/pages/Entity/components/Case/Case.Actions.tsx [80-87]

    -{showResolutionButtons && workflowDefinition && (
    +{showResolutionButtons && workflowDefinition ? (
       <ActionsVariant
         workflowDefinition={{
    -      version: workflowDefinition?.version,
    -      variant: workflowDefinition?.variant,
    -      config: workflowDefinition?.config,
    +      version: workflowDefinition.version,
    +      variant: workflowDefinition.variant,
    +      config: workflowDefinition.config,
         }}
       />
    -)}
    +) : null}
     
    Security
    Validate or sanitize inputs used in queries to prevent security vulnerabilities.

    Ensure that workflowId and filterId are validated or sanitized before being used in
    queries to prevent potential security vulnerabilities.

    apps/backoffice-v2/src/pages/Entity/components/Case/hooks/useCaseActionsLogic/useCaseActionsLogic.tsx [16-19]

    +// Ensure workflowId and filterId are validated or sanitized
    +const sanitizedWorkflowId = sanitize(workflowId);
    +const sanitizedFilterId = sanitize(filterId);
     const { data: workflow, isLoading: isLoadingCase } = useWorkflowByIdQuery({
    -  workflowId,
    -  filterId,
    +  workflowId: sanitizedWorkflowId,
    +  filterId: sanitizedFilterId,
     });
     

    ✨ Improve tool usage guide:

    Overview:
    The improve tool scans the PR code changes, and automatically generates suggestions for improving the PR code. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.
    When commenting, to edit configurations related to the improve tool (pr_code_suggestions section), use the following template:

    /improve --pr_code_suggestions.some_config1=... --pr_code_suggestions.some_config2=...
    

    With a configuration file, use the following template:

    [pr_code_suggestions]
    some_config1=...
    some_config2=...
    
    Enabling\disabling automation

    When you first install the app, the default mode for the improve tool is:

    pr_commands = ["/improve --pr_code_suggestions.summarize=true", ...]
    

    meaning the improve tool will run automatically on every PR, with summarization enabled. Delete this line to disable the tool from running automatically.

    Utilizing extra instructions

    Extra instructions are very important for the improve tool, since they enable to guide the model to suggestions that are more relevant to the specific needs of the project.

    Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify relevant aspects that you want the model to focus on.

    Examples for extra instructions:

    [pr_code_suggestions] # /improve #
    extra_instructions="""
    Emphasize the following aspects:
    - Does the code logic cover relevant edge cases?
    - Is the code logic clear and easy to understand?
    - Is the code logic efficient?
    ...
    """
    

    Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.

    A note on code suggestions quality
    • While the current AI for code is getting better and better (GPT-4), it's not flawless. Not all the suggestions will be perfect, and a user should not accept all of them automatically.
    • Suggestions are not meant to be simplistic. Instead, they aim to give deep feedback and raise questions, ideas and thoughts to the user, who can then use his judgment, experience, and understanding of the code base.
    • Recommended to use the 'extra_instructions' field to guide the model to suggestions that are more relevant to the specific needs of the project, or use the custom suggestions 💎 tool
    • With large PRs, best quality will be obtained by using 'improve --extended' mode.
    More PR-Agent commands

    To invoke the PR-Agent, add a comment using one of the following commands:

    • /review: Request a review of your Pull Request.
    • /describe: Update the PR title and description based on the contents of the PR.
    • /improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
    • /ask <QUESTION>: Ask a question about the PR.
    • /update_changelog: Update the changelog based on the PR's contents.
    • /add_docs 💎: Generate docstring for new components introduced in the PR.
    • /generate_labels 💎: Generate labels for the PR based on the PR's contents.
    • /analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

    See the tools guide for more details.
    To list the possible configuration parameters, add a /config comment.

    See the improve usage page for a more comprehensive guide on using this tool.

    Omri-Levy and others added 4 commits March 4, 2024 10:52
    * refactor(backoffice-v2): moved mocks position
    
    * fix(backoffice-v2): fixed flagged badge variant
    
    * refactor(backoffice-v2): removed aml mocks
    
    * refactor(*): addressed pr comments
    
    ---------
    
    Co-authored-by: Alon Peretz <[email protected]>
    * feat: ts fix
    
    * feat: pr comments fix
    * feat: ongoing monitoring
    
    * chore(package.json): update db:reset:dev:with-data script to use db:reset:dev script before running db:data-migration:migrate
    
    fix(prisma): update subproject commit hash in data-migrations
    
    feat(prisma): add config column to Customer table
    
    feat(app.module): import WebhooksModule
    
    feat(zod-schemas): add CustomerConfigSchema and TCustomerConfig types
    
    fix(end-user.repository): update import path for PrismaService
    
    feat(end-user.service): add missing line break
    
    fix(filter.repository): update scopeService.scopeFindFirst method call
    
    fix(global.d.ts): add config and subscriptions fields to Customer type
    
    feat(webhooks): add AmlWebhookInput and IndividualAmlWebhookInput DTOs
    
    feat(webhooks): add webhooks controller, module, and service
    
    - Add a new file `webhooks.controller.ts` to handle webhooks related requests.
    - Add a new file `webhooks.module.ts` to define the webhooks module and its dependencies.
    - Add a new file `webhooks.service.ts` to handle webhook events.
    - Implement the `amlHook` method in the `WebhooksController` to handle AML webhook events.
    - Implement the `handleAmlHit` method in the `WebhooksService` to handle AML_HIT events.
    - Update the imports and dependencies in the existing files to include the newly added files.
    
    The purpose of these changes is to introduce a new feature that allows handling AML webhook events in the application. This feature will enable the application to respond to AML_HIT events and perform necessary actions based on the event data.
    
    * refactor(backoffice-v2): moved aml cells to a re-usable hook
    
    * refactor(backoffice-v2): added an on-going blocks variant
    
    * feat(backoffice-v2): added an actions variant for on-going
    
    * chore(package.json): update db:reset:dev:with-data script to use db:reset:dev script before running db:data-migration:migrate
    
    chore(package.json): add new migration script for adding a config column to the Customer table
    
    chore(schema.prisma): add config field to the Customer model
    
    chore(app.module.ts): import and add WebhooksModule to the AppModule
    
    chore(zod-schemas.ts): add CustomerConfigSchema and TCustomerConfig types
    
    chore(end-user.repository.ts): update import path for PrismaService
    
    chore(end-user.repository.ts): add new method findByIdUnscoped to retrieve end user by id without applying project scope
    
    chore(end-user.service.ts): add missing line break
    
    chore(filter.repository.ts): update scopeService.scopeFindFirst to scopeService.scopeFindFirst with projectIds parameter
    
    chore(global.d.ts): add config field to the Customer type
    
    chore(webhooks/dtos/aml-webhook-input.ts): create AmlWebhookInput class
    
    chore(webhooks/dtos/individual-aml-webhook-input.ts): create IndividualAmlWebhookInput class
    
    feat(webhooks): add webhooks controller, module, and service
    
    - Add a new file `webhooks.controller.ts` to handle webhooks related requests.
    - Add a new file `webhooks.module.ts` to define the webhooks module and its dependencies.
    - Add a new file `webhooks.service.ts` to handle webhook events.
    - Implement the `amlHook` method in the `WebhooksController` to handle AML webhook events.
    - Implement the `handleAmlHit` method in the `WebhooksService` to handle AML_HIT events.
    - Update the imports and dependencies in the existing files to include the newly added files.
    
    The purpose of these changes is to introduce a new feature that allows handling AML webhook events in the application. This feature will enable the application to respond to AML_HIT events and perform necessary actions based on the event data.
    
    * chore(package.json): update db:reset:dev:with-data script to use db:reset:dev script before running db:data-migration:migrate
    
    fix(prisma): update subproject commit hash in data-migrations
    
    feat(prisma): add config column to Customer table
    
    feat(app.module): import WebhooksModule
    
    feat(zod-schemas): add CustomerConfigSchema and TCustomerConfig types
    
    fix(end-user.repository): update import path for PrismaService
    
    feat(end-user.service): add missing line break
    
    fix(filter.repository): update scopeService.scopeFindFirst method call
    
    fix(global.d.ts): add config and subscriptions fields to Customer type
    
    feat(webhooks): add AmlWebhookInput and IndividualAmlWebhookInput DTOs
    
    feat(webhooks): add webhooks controller, module, and service
    
    - Add a new file `webhooks.controller.ts` to handle webhooks related requests.
    - Add a new file `webhooks.module.ts` to define the webhooks module and its dependencies.
    - Add a new file `webhooks.service.ts` to handle webhook events.
    - Implement the `amlHook` method in the `WebhooksController` to handle AML webhook events.
    - Implement the `handleAmlHit` method in the `WebhooksService` to handle AML_HIT events.
    - Update the imports and dependencies in the existing files to include the newly added files.
    
    The purpose of these changes is to introduce a new feature that allows handling AML webhook events in the application. This feature will enable the application to respond to AML_HIT events and perform necessary actions based on the event data.
    
    * feat: more work
    
    * feat: test fix
    
    * chore(workflows-service): update subproject commit hash in data-migrations
    refactor(business.controller.internal): remove unused import of ProjectScopeService
    fix(customer.repository): fix import path for PrismaService
    test(workflow-definition.service.intg.test): update filterService.getById calls to pass correct project id argument
    
    * chore(workflows-service): update subproject commit hash in data-migrations
    refactor(business.controller.internal): remove unused import of ProjectScopeService
    fix(customer.repository): fix import path for PrismaService
    test(workflow-definition.service.intg.test): update filterService.getById calls to pass correct project id parameter
    
    * chore(workflows-service): update subproject commit hash in data-migrations
    refactor(business.controller.internal): remove unused import of ProjectScopeService
    fix(customer.repository): fix import path for PrismaService
    test(workflow-definition.service.intg.test): update filterService.getById calls to pass correct project id argument
    
    * service
    
    * service
    
    * feat(backoffice-v2): added temporary mocks
    
    * feat: small fixes
    
    * feat: small fix
    
    * Backoffice on-going (#2143)
    
    * refactor(backoffice-v2): moved mocks position
    
    * fix(backoffice-v2): fixed flagged badge variant
    
    * refactor(backoffice-v2): removed aml mocks
    
    * refactor(*): addressed pr comments
    
    ---------
    
    Co-authored-by: Alon Peretz <[email protected]>
    
    * Ongoing Monitoring (#2133)
    
    * feat: ts fix
    
    * feat: pr comments fix
    
    * feat: fixes for aml block
    
    ---------
    
    Co-authored-by: Omri Levy <[email protected]>
    Co-authored-by: Alon Peretz <[email protected]>
    Co-authored-by: Omri Levy <[email protected]>
    @tomer-shvadron tomer-shvadron merged commit fb0a773 into dev Mar 5, 2024
    9 checks passed
    @tomer-shvadron tomer-shvadron deleted the feat/ongoing branch March 5, 2024 16:36
    chesterkmr pushed a commit that referenced this pull request Mar 11, 2024
    * feat: ongoing monitoring
    
    * chore(package.json): update db:reset:dev:with-data script to use db:reset:dev script before running db:data-migration:migrate
    
    fix(prisma): update subproject commit hash in data-migrations
    
    feat(prisma): add config column to Customer table
    
    feat(app.module): import WebhooksModule
    
    feat(zod-schemas): add CustomerConfigSchema and TCustomerConfig types
    
    fix(end-user.repository): update import path for PrismaService
    
    feat(end-user.service): add missing line break
    
    fix(filter.repository): update scopeService.scopeFindFirst method call
    
    fix(global.d.ts): add config and subscriptions fields to Customer type
    
    feat(webhooks): add AmlWebhookInput and IndividualAmlWebhookInput DTOs
    
    feat(webhooks): add webhooks controller, module, and service
    
    - Add a new file `webhooks.controller.ts` to handle webhooks related requests.
    - Add a new file `webhooks.module.ts` to define the webhooks module and its dependencies.
    - Add a new file `webhooks.service.ts` to handle webhook events.
    - Implement the `amlHook` method in the `WebhooksController` to handle AML webhook events.
    - Implement the `handleAmlHit` method in the `WebhooksService` to handle AML_HIT events.
    - Update the imports and dependencies in the existing files to include the newly added files.
    
    The purpose of these changes is to introduce a new feature that allows handling AML webhook events in the application. This feature will enable the application to respond to AML_HIT events and perform necessary actions based on the event data.
    
    * refactor(backoffice-v2): moved aml cells to a re-usable hook
    
    * refactor(backoffice-v2): added an on-going blocks variant
    
    * feat(backoffice-v2): added an actions variant for on-going
    
    * chore(package.json): update db:reset:dev:with-data script to use db:reset:dev script before running db:data-migration:migrate
    
    chore(package.json): add new migration script for adding a config column to the Customer table
    
    chore(schema.prisma): add config field to the Customer model
    
    chore(app.module.ts): import and add WebhooksModule to the AppModule
    
    chore(zod-schemas.ts): add CustomerConfigSchema and TCustomerConfig types
    
    chore(end-user.repository.ts): update import path for PrismaService
    
    chore(end-user.repository.ts): add new method findByIdUnscoped to retrieve end user by id without applying project scope
    
    chore(end-user.service.ts): add missing line break
    
    chore(filter.repository.ts): update scopeService.scopeFindFirst to scopeService.scopeFindFirst with projectIds parameter
    
    chore(global.d.ts): add config field to the Customer type
    
    chore(webhooks/dtos/aml-webhook-input.ts): create AmlWebhookInput class
    
    chore(webhooks/dtos/individual-aml-webhook-input.ts): create IndividualAmlWebhookInput class
    
    feat(webhooks): add webhooks controller, module, and service
    
    - Add a new file `webhooks.controller.ts` to handle webhooks related requests.
    - Add a new file `webhooks.module.ts` to define the webhooks module and its dependencies.
    - Add a new file `webhooks.service.ts` to handle webhook events.
    - Implement the `amlHook` method in the `WebhooksController` to handle AML webhook events.
    - Implement the `handleAmlHit` method in the `WebhooksService` to handle AML_HIT events.
    - Update the imports and dependencies in the existing files to include the newly added files.
    
    The purpose of these changes is to introduce a new feature that allows handling AML webhook events in the application. This feature will enable the application to respond to AML_HIT events and perform necessary actions based on the event data.
    
    * chore(package.json): update db:reset:dev:with-data script to use db:reset:dev script before running db:data-migration:migrate
    
    fix(prisma): update subproject commit hash in data-migrations
    
    feat(prisma): add config column to Customer table
    
    feat(app.module): import WebhooksModule
    
    feat(zod-schemas): add CustomerConfigSchema and TCustomerConfig types
    
    fix(end-user.repository): update import path for PrismaService
    
    feat(end-user.service): add missing line break
    
    fix(filter.repository): update scopeService.scopeFindFirst method call
    
    fix(global.d.ts): add config and subscriptions fields to Customer type
    
    feat(webhooks): add AmlWebhookInput and IndividualAmlWebhookInput DTOs
    
    feat(webhooks): add webhooks controller, module, and service
    
    - Add a new file `webhooks.controller.ts` to handle webhooks related requests.
    - Add a new file `webhooks.module.ts` to define the webhooks module and its dependencies.
    - Add a new file `webhooks.service.ts` to handle webhook events.
    - Implement the `amlHook` method in the `WebhooksController` to handle AML webhook events.
    - Implement the `handleAmlHit` method in the `WebhooksService` to handle AML_HIT events.
    - Update the imports and dependencies in the existing files to include the newly added files.
    
    The purpose of these changes is to introduce a new feature that allows handling AML webhook events in the application. This feature will enable the application to respond to AML_HIT events and perform necessary actions based on the event data.
    
    * feat: more work
    
    * feat: test fix
    
    * chore(workflows-service): update subproject commit hash in data-migrations
    refactor(business.controller.internal): remove unused import of ProjectScopeService
    fix(customer.repository): fix import path for PrismaService
    test(workflow-definition.service.intg.test): update filterService.getById calls to pass correct project id argument
    
    * chore(workflows-service): update subproject commit hash in data-migrations
    refactor(business.controller.internal): remove unused import of ProjectScopeService
    fix(customer.repository): fix import path for PrismaService
    test(workflow-definition.service.intg.test): update filterService.getById calls to pass correct project id parameter
    
    * chore(workflows-service): update subproject commit hash in data-migrations
    refactor(business.controller.internal): remove unused import of ProjectScopeService
    fix(customer.repository): fix import path for PrismaService
    test(workflow-definition.service.intg.test): update filterService.getById calls to pass correct project id argument
    
    * service
    
    * service
    
    * feat(backoffice-v2): added temporary mocks
    
    * feat: small fixes
    
    * feat: small fix
    
    * Backoffice on-going (#2143)
    
    * refactor(backoffice-v2): moved mocks position
    
    * fix(backoffice-v2): fixed flagged badge variant
    
    * refactor(backoffice-v2): removed aml mocks
    
    * refactor(*): addressed pr comments
    
    ---------
    
    Co-authored-by: Alon Peretz <[email protected]>
    
    * Ongoing Monitoring (#2133)
    
    * feat: ts fix
    
    * feat: pr comments fix
    
    * Fixes for AML block (#2152)
    
    * feat: ongoing monitoring
    
    * chore(package.json): update db:reset:dev:with-data script to use db:reset:dev script before running db:data-migration:migrate
    
    fix(prisma): update subproject commit hash in data-migrations
    
    feat(prisma): add config column to Customer table
    
    feat(app.module): import WebhooksModule
    
    feat(zod-schemas): add CustomerConfigSchema and TCustomerConfig types
    
    fix(end-user.repository): update import path for PrismaService
    
    feat(end-user.service): add missing line break
    
    fix(filter.repository): update scopeService.scopeFindFirst method call
    
    fix(global.d.ts): add config and subscriptions fields to Customer type
    
    feat(webhooks): add AmlWebhookInput and IndividualAmlWebhookInput DTOs
    
    feat(webhooks): add webhooks controller, module, and service
    
    - Add a new file `webhooks.controller.ts` to handle webhooks related requests.
    - Add a new file `webhooks.module.ts` to define the webhooks module and its dependencies.
    - Add a new file `webhooks.service.ts` to handle webhook events.
    - Implement the `amlHook` method in the `WebhooksController` to handle AML webhook events.
    - Implement the `handleAmlHit` method in the `WebhooksService` to handle AML_HIT events.
    - Update the imports and dependencies in the existing files to include the newly added files.
    
    The purpose of these changes is to introduce a new feature that allows handling AML webhook events in the application. This feature will enable the application to respond to AML_HIT events and perform necessary actions based on the event data.
    
    * refactor(backoffice-v2): moved aml cells to a re-usable hook
    
    * refactor(backoffice-v2): added an on-going blocks variant
    
    * feat(backoffice-v2): added an actions variant for on-going
    
    * chore(package.json): update db:reset:dev:with-data script to use db:reset:dev script before running db:data-migration:migrate
    
    chore(package.json): add new migration script for adding a config column to the Customer table
    
    chore(schema.prisma): add config field to the Customer model
    
    chore(app.module.ts): import and add WebhooksModule to the AppModule
    
    chore(zod-schemas.ts): add CustomerConfigSchema and TCustomerConfig types
    
    chore(end-user.repository.ts): update import path for PrismaService
    
    chore(end-user.repository.ts): add new method findByIdUnscoped to retrieve end user by id without applying project scope
    
    chore(end-user.service.ts): add missing line break
    
    chore(filter.repository.ts): update scopeService.scopeFindFirst to scopeService.scopeFindFirst with projectIds parameter
    
    chore(global.d.ts): add config field to the Customer type
    
    chore(webhooks/dtos/aml-webhook-input.ts): create AmlWebhookInput class
    
    chore(webhooks/dtos/individual-aml-webhook-input.ts): create IndividualAmlWebhookInput class
    
    feat(webhooks): add webhooks controller, module, and service
    
    - Add a new file `webhooks.controller.ts` to handle webhooks related requests.
    - Add a new file `webhooks.module.ts` to define the webhooks module and its dependencies.
    - Add a new file `webhooks.service.ts` to handle webhook events.
    - Implement the `amlHook` method in the `WebhooksController` to handle AML webhook events.
    - Implement the `handleAmlHit` method in the `WebhooksService` to handle AML_HIT events.
    - Update the imports and dependencies in the existing files to include the newly added files.
    
    The purpose of these changes is to introduce a new feature that allows handling AML webhook events in the application. This feature will enable the application to respond to AML_HIT events and perform necessary actions based on the event data.
    
    * chore(package.json): update db:reset:dev:with-data script to use db:reset:dev script before running db:data-migration:migrate
    
    fix(prisma): update subproject commit hash in data-migrations
    
    feat(prisma): add config column to Customer table
    
    feat(app.module): import WebhooksModule
    
    feat(zod-schemas): add CustomerConfigSchema and TCustomerConfig types
    
    fix(end-user.repository): update import path for PrismaService
    
    feat(end-user.service): add missing line break
    
    fix(filter.repository): update scopeService.scopeFindFirst method call
    
    fix(global.d.ts): add config and subscriptions fields to Customer type
    
    feat(webhooks): add AmlWebhookInput and IndividualAmlWebhookInput DTOs
    
    feat(webhooks): add webhooks controller, module, and service
    
    - Add a new file `webhooks.controller.ts` to handle webhooks related requests.
    - Add a new file `webhooks.module.ts` to define the webhooks module and its dependencies.
    - Add a new file `webhooks.service.ts` to handle webhook events.
    - Implement the `amlHook` method in the `WebhooksController` to handle AML webhook events.
    - Implement the `handleAmlHit` method in the `WebhooksService` to handle AML_HIT events.
    - Update the imports and dependencies in the existing files to include the newly added files.
    
    The purpose of these changes is to introduce a new feature that allows handling AML webhook events in the application. This feature will enable the application to respond to AML_HIT events and perform necessary actions based on the event data.
    
    * feat: more work
    
    * feat: test fix
    
    * chore(workflows-service): update subproject commit hash in data-migrations
    refactor(business.controller.internal): remove unused import of ProjectScopeService
    fix(customer.repository): fix import path for PrismaService
    test(workflow-definition.service.intg.test): update filterService.getById calls to pass correct project id argument
    
    * chore(workflows-service): update subproject commit hash in data-migrations
    refactor(business.controller.internal): remove unused import of ProjectScopeService
    fix(customer.repository): fix import path for PrismaService
    test(workflow-definition.service.intg.test): update filterService.getById calls to pass correct project id parameter
    
    * chore(workflows-service): update subproject commit hash in data-migrations
    refactor(business.controller.internal): remove unused import of ProjectScopeService
    fix(customer.repository): fix import path for PrismaService
    test(workflow-definition.service.intg.test): update filterService.getById calls to pass correct project id argument
    
    * service
    
    * service
    
    * feat(backoffice-v2): added temporary mocks
    
    * feat: small fixes
    
    * feat: small fix
    
    * Backoffice on-going (#2143)
    
    * refactor(backoffice-v2): moved mocks position
    
    * fix(backoffice-v2): fixed flagged badge variant
    
    * refactor(backoffice-v2): removed aml mocks
    
    * refactor(*): addressed pr comments
    
    ---------
    
    Co-authored-by: Alon Peretz <[email protected]>
    
    * Ongoing Monitoring (#2133)
    
    * feat: ts fix
    
    * feat: pr comments fix
    
    * feat: fixes for aml block
    
    ---------
    
    Co-authored-by: Omri Levy <[email protected]>
    Co-authored-by: Alon Peretz <[email protected]>
    Co-authored-by: Omri Levy <[email protected]>
    
    ---------
    
    Co-authored-by: Tomer Shvadron <[email protected]>
    Co-authored-by: Omri Levy <[email protected]>
    Co-authored-by: Omri Levy <[email protected]>
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    3 participants