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

bal 1589 rules after schema changes #2189

Closed
wants to merge 104 commits into from

Conversation

liorzam
Copy link
Collaborator

@liorzam liorzam commented Mar 12, 2024

No description provided.

alonp99 and others added 28 commits February 19, 2024 22:52
* fix: swagger

* fix: revert

* fix: eslint

---------

Co-authored-by: Lior Zamir <[email protected]>
* feat(*): the transactions drawer no longer uses hardcoded heading and summary

* feat(backoffice-v2): added counterparty id to search query params

* refactor(backoffice-v2): removed alert-definitions domain and moved logic to alerts domain

* feat(backoffice-v2): added loading state to heading and summary

* feat(backoffice-v2): added fallback state to alerts drawer

* refactor(seed.ts): updated seed to alternative between business and counterparty id

* revert(*): reverted counterparty id changes

* fix(*): fixed changes that broke from conflicts

* refactor(workflows-service): added optional chaining

* fix(workflows-service): lint error
* fix(backoffice-v2): fixed filters in state but not in the url reaching the backend

* refactor(backoffice-v2): removed console.log

* revert(backoffice-v2): removed assignee default filter

* fix(backoffice-v2): fixed key warning on navbar

* fix(*): lockfile fix
* refactor(*): updated instances of alert state

* refactor(backoffice-v2): updated toast text

* refactor(backoffice-v2): simplified pattern matching for decision

* refactor(workflows-service): addressed pr comment

* fix(workflows-service): fixed return of function
…chema to support filtering by alert type

fix(TransactionMonitoringAlertsAnalysis.page.tsx): add key prop to AlertAnalysisSheet component to force re-render when alertId changes
fix(useTransactionMonitoringAlertsAnalysisPageLogic.tsx): remove duplicate navigateBack() call in useEffect hook
fix(schema.prisma): fix indentation and rename underReview enum value to under_review for consistency
fix(alert.service.ts): fix mapping of under_review enum value to pending status
…lows-service/prisma/data-migrations' to 'all' for consistency

refactor(fetchers.ts): remove unused 'business' field from TransactionsListSchema transform function to simplify code

refactor(fetchers.ts): remove unused 'business' field from TransactionsListSchema transform function to simplify code

refactor(useTransactionsQuery.tsx): remove unused 'businessId' parameter from useTransactionsQuery hook to simplify code

refactor(query-keys.ts): remove unused 'businessId' parameter from transactionsQueryKeys.list function to simplify code

chore(workflows-service): update submodule commit reference to 'e2be2ce2e82641da25de172577c6835678dd2182'

feat(workflows-service): add migration to remove TransactionRecord unique correlationId and denormalization of EndUser/Business

feat(workflows-service): add migration to remove TransactionRecord unique correlationId and denormalization of EndUser/Business

feat(workflows-service): add migration to remove TransactionRecord unique correlationId and denormalization of EndUser/Business

feat(workflows-service): add migration to remove TransactionRecord unique correlationId and denormalization of EndUser/Business

feat(workflows-service): add migration to remove TransactionRecord unique correlationId and denormalization of EndUser/Business

feat(workflows-service): add migration to remove TransactionRecord unique correlationId and denormalization of EndUser/Business

feat(workflows-service): add migration to remove TransactionRecord unique correlationId and denormalization of EndUser/Business

feat(workflows-service): add migration to remove TransactionRecord unique correlationId and denormalization of EndUser/Business

feat(workflows-service): add migration to remove TransactionRecord unique correlationId and denormalization of EndUser/Business

feat(workflows-service): add migration to remove TransactionRecord unique correlationId and denormalization of EndUser/Business

feat(workflows-service): add migration to remove TransactionRecord unique correlationId and denormalization of EndUser/Business

feat(workflows-service): add migration to remove TransactionRecord unique correlationId and denormalization of EndUser/Business

feat(workflows-service): add migration to remove TransactionRecord unique correlationId and denormalization of EndUser/Business

feat(workflows-service): add migration to remove TransactionRecord unique correlationId and denormalization of EndUser/Business

feat(workflows-service): add migration to remove Transaction

fix(generate-alerts.ts): import missing type 'InputJsonValue' from '@/types'
fix(generate-alerts.ts): remove unused import statements
fix(generate-alerts.ts): remove unused variable 'tags'
fix(generate-alerts.ts): remove unused parameter 'ids' from generateFakeAlertDefinition function
fix(generate-alerts.ts): remove unused parameter 'ids' from generateFakeAlert function
fix(generate-alerts.ts): remove unused variable 'businessIdCounterpartyOriginatorIdOrBoth'
fix(generate-alerts.ts): remove unused variable 'counterpartyId'
fix(generate-alerts.ts): remove unused variable 'counterpartyOriginatorId'
fix(generate-alerts.ts): remove unused variable 'counterpartyBeneficiaryId'
fix(generate-alerts.ts): remove unused variable 'randomCounterpartyId'
fix(generate-alerts.ts): remove unused variable 'getRandomCounterpartyId'
fix(generate-alerts.ts): remove unused variable 'correlationId'
fix(generate-alerts.ts): remove unused variable 'counterparty'
fix(generate-alerts.ts): remove unused variable 'data'
fix(generate-alerts.ts): remove unused variable 'res'
fix(generate-alerts.ts): remove unused variable 'workflow'
fix(generate-alerts.ts): remove unused variable 'workflowDefinitionId'
fix(generate-alerts.ts): remove unused variable 'workflowDefinitionVersion'
fix(generate-alerts.ts): remove unused variable 'state'
fix(generate-alerts.ts): remove unused variable 'context'
fix(generate-alerts.ts): remove unused variable 'createdAt'
fix(generate-alerts.ts): remove unused variable 'parentRuntimeDataId'
fix(generate-alerts.ts): remove unused variable 'tags'
fix(generate-transactions.ts): import missing types 'Business' and 'EndUser' from '@prisma/client'
fix(generate-transactions.ts): import missing functions 'generateBusiness' and 'generateEndUser' from '../generate-end-user'
fix(generate-transactions.ts): remove unused import statement
fix(generate-transactions.ts): remove unused variable 'correlationId'
fix(generate-transactions.ts): remove unused variable 'counterparty'
fix(generate-transactions.ts): remove unused variable 'data'
fix(generate-transactions.ts): remove unused variable 'res'
fix(generate-transactions.ts): remove unused variable 'workflow'
fix(generate-transactions.ts): remove unused variable 'workflowDefinitionId'
fix(generate-trans

fix(alert.controller.external.ts): fix import statement for express module
feat(alert.controller.external.ts): add support for returning 207 status code for partial success in assignAlertById and decision methods
fix(alert.controller.external.ts): fix parameter name in assignAlertById and decision methods
fix(alert.controller.external.ts): fix return type of assignAlertById and decision methods
fix(alert.controller.external.ts): fix createBulkResponse method to return status code and response
feat(alert.module.ts): add SentryModule to imports
fix(assign-alert.dto.ts): fix typo in AlertAssigneeUniqueDto property name
feat(assign-alert.dto.ts): add ErrorResponse class for error response in AlertUpdateResponse
fix(assign-alert.dto.ts): fix AlertUpdateResponse class to use enum for status property and add errors property
fix(types.ts): remove PARTIAL status from BulkStatus enum
fix(types.ts): change TBulkAssignAlertsResponse type to array of SuccessResponse and FailedResponse

fix(HttpExceptions.filter.ts): import PRISMA_UNIQUE_CONSTRAINT_ERROR constant from prisma.util to handle unique key constraint violation error
fix(data-analytics.service.intg.test.ts): remove CounterpartyType import as it is no longer used
fix(end-user-create.ts): remove optional decorator from companyName property
feat(end-user-create-with-business.ts): create new DTO class to handle creation of end user with associated business
fix(end-user.controller.external.ts): update createWithBusiness method to use EndUserCreateWithBusinessDto instead of EndUserCreateDto
fix(end-user.repository.ts): remove unused findByCorrelationIdUnscoped method
fix(end-user.service.ts): remove correlationId property from endUser parameter in createWithBusiness method
fix(prisma.util.ts): import and use PRISMA_UNIQUE_CONSTRAINT_ERROR constant to handle unique key constraint violation error

fix(sentry.interceptor.ts): refactor SentryInterceptor to use SentryService for capturing exceptions and http exceptions
feat(sentry.service.ts): create SentryService to handle capturing exceptions and http exceptions with additional data
fix(swagger.ts): fix typo in addServer method
feat(bulk-transactions-created.dto.ts): create BulkTransactionsCreatedDto to represent the response for bulk transactions creation
fix(get-transactions.dto.ts): remove unused businessId property from GetTransactionsDto

fix(transaction-create.dto.ts): import OmitType from @nestjs/swagger to use in CounterpartyInfo class
fix(transaction-create.dto.ts): change IsDate decorator to IsDateString decorator in TransactionCreateDto class
fix(transaction-create.dto.ts): remove projectId property from TransactionCreateDto class
fix(transaction-create.dto.ts): remove individual property from TransactionCreateDto class
fix(transaction-create.dto.ts): make originator property required in TransactionCreateDto class
fix(transaction-create.dto.ts): make beneficiary property required in TransactionCreateDto class
feat(transaction-created.dto.ts): create TransactionCreatedDto class with id and correlationId properties

feat(transaction): add integration tests for external transaction controller

This commit adds integration tests for the external transaction controller. The tests cover the following scenarios:

1. Creating a transaction with a business originator and an end user beneficiary.
2. Creating a transaction with an existing business as the originator and an existing end user as the beneficiary.
3. Returning a 400 status code when validation fails.
4. Creating multiple transactions with a business originator and an end user beneficiary.
5. Creating multiple transactions with existing counterparties.
6. Creating multiple transactions with some transactions failing.
7. Returning a 400 status code when validation fails for bulk transactions.
8. Returning a 400 status code when the counterparty is missing from the request body.
9. Returning a 400 status code when the counterparty is missing an entity (business or end user).
10. Returning a 400 status code when the counterparty has both a business and an end user.

These tests ensure that the external transaction controller functions correctly and handles various scenarios.

refactor(transaction.controller.external.ts): improve code readability and maintainability by organizing imports and formatting code
feat(transaction.controller.external.ts): add validation and error handling for transaction creation endpoints
feat(transaction.controller.external.ts): add support for bulk transaction creation endpoint
fix(transaction.controller.external.ts): remove unnecessary include in getTransactions method

fix(transaction.mapper.ts): refactor toCreateData method to improve readability and error handling
feat(transaction.mapper.ts): add support for creating counterpartyOriginator and counterpartyBeneficiary records
fix(transaction.module.ts): add SentryService as a provider in TransactionModule for error tracking

fix(transaction.repository.ts): remove unused import and delete unused validation file
feat(transaction.service.ts): add support for creating multiple transactions in bulk and handle unique constraint error
… and related code

The migration.sql file contains SQL commands to drop the `businessId` and `endUserId` columns from the `Alert` table. These columns will be removed and all data in them will be lost.

In the schema.prisma file, the `businessId` and `endUserId` fields are removed from the `Alert` model. The `Alert` model no longer has relationships with the `Business` and `EndUser` models.

In the alert.controller.external.ts file, the `business` field is replaced with `counterparty` field in the select statement. The `counterparty` field includes the `id`, `companyName`, `business`, and `endUser` fields.

In the alert.service.ts file, the `businessId` and `endUserId` fields are removed from the `data` parameter of the `createAlert` method. The `createAlert` method now only accepts the `counterpartyId` field.
* refactor: expose `generateAlertDefinitions` function

* feat: add migration
commit 13e2390bf0940df4e3276b64c11b2c75cb7400eb
Author: Lior Zamir <[email protected]>
Date:   Mon Mar 11 16:21:33 2024 +0200

    chore: remove non used rules

commit 34f8eff
Author: Lior Zamir <[email protected]>
Date:   Mon Mar 11 16:17:20 2024 +0200

    fix: add missing private functions

commit e5d7552
Merge: 51afe72 00aa41e
Author: Lior Zamir <[email protected]>
Date:   Wed Mar 6 01:22:29 2024 +0200

    chore: merge branch

commit 51afe72
Author: Lior Zamir <[email protected]>
Date:   Wed Mar 6 01:19:39 2024 +0200

    fix: ts issues

commit fe9cf42
Author: Lior Zamir <[email protected]>
Date:   Wed Mar 6 01:15:56 2024 +0200

    fix: ts issues

commit 00aa41e
Author: Lior Zamir <[email protected]>
Date:   Wed Mar 6 00:59:53 2024 +0200

    fix(generate-alerts.ts): import missing types and add missing type annotation for TransactionRecordType
    fix(alert.service.ts): add error handling when checking alert and log error message and definition ID

    fix(data-analytics.service.ts): fix formatting and indentation for better readability
    feat(data-analytics.service.ts): add support for evaluating payment unexpected based on customer expected amount
    feat(data-analytics.service.ts): add support for evaluating dormant accounts based on transaction history
    feat(data-analytics.service.ts): add support for evaluating customers' transaction type based on various criteria

    feat(types.ts): add support for new transaction record type and generic async function type
    feat(types.ts): add new options for TCustomersTransactionTypeOptions to support more flexible customer transaction filtering
    feat(types.ts): add new options for TDormantAccountOption to support evaluating dormant accounts
    feat(types.ts): add new evaluate functions for evaluating transactions against dynamic rules and dormant accounts

commit 7b0dddf
Author: Lior Zamir <[email protected]>
Date:   Wed Mar 6 00:59:53 2024 +0200

    feat: add more rules
Copy link

changeset-bot bot commented Mar 12, 2024

⚠️ No Changeset found

Latest commit: e42f4c0

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

@liorzam liorzam closed this Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants