-
Notifications
You must be signed in to change notification settings - Fork 168
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-1964 - Transaction monitoring - add dormant rule #2353
Conversation
|
WalkthroughThis update enriches the system with a new alert for dormant accounts, refines data analytics using CTE-based queries, enhances exception handling, and improves the generation of transaction dates. Type safety is bolstered with enums and custom types across modules. Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
PR Description updated to latest commit (4521871) |
PR Review 🔍(Review updated until commit 7c2cfe7)
Code feedback:
|
PR Code Suggestions ✨
|
PR Description updated to latest commit (7c2cfe7) |
Persistent review updated to latest commit 7c2cfe7 |
PR Code Suggestions ✨
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (6)
- services/workflows-service/scripts/alerts/generate-alerts.ts (1 hunks)
- services/workflows-service/src/alert/alert.service.intg.test.ts (6 hunks)
- services/workflows-service/src/common/filters/HttpExceptions.filter.ts (1 hunks)
- services/workflows-service/src/data-analytics/data-analytics.service.ts (2 hunks)
- services/workflows-service/src/data-analytics/types.ts (6 hunks)
- services/workflows-service/src/transaction/test-utils/transaction-factory.ts (1 hunks)
Additional comments not posted (14)
services/workflows-service/src/data-analytics/types.ts (5)
1-1
: Import ofTProjectId
from '@/types' is correctly added to ensure type safety and consistency across the project.
40-40
: Update ofprojectId
to useTProjectId
enhances type safety and consistency, aligning with best practices for TypeScript development.
56-56
: The change to useTProjectId
forprojectId
inHighTransactionTypePercentage
is a good practice for maintaining type consistency and safety.
66-66
: UsingTProjectId
forprojectId
inTCustomersTransactionTypeOptions
correctly enforces type consistency across the service.
77-77
: The update to useTProjectId
forprojectId
inTransactionLimitHistoricAverageOptions
is appropriate for ensuring type safety.services/workflows-service/src/common/filters/HttpExceptions.filter.ts (1)
7-7
: RefactoringErrorCodesStatusMapping
to use keys fromHttpStatus
directly simplifies the mapping and improves code clarity.services/workflows-service/src/transaction/test-utils/transaction-factory.ts (1)
73-73
: ChangingtransactionDate
to randomly select dates from either the past year or the last 30 days introduces more variability and realism in test data generation.services/workflows-service/src/data-analytics/data-analytics.service.ts (1)
314-336
: The new CTE-based SQL query inevaluateDormantAccount
enhances clarity and maintainability of the SQL operations. Ensure that the logic correctly identifies dormant accounts based on the specified conditions.services/workflows-service/scripts/alerts/generate-alerts.ts (1)
416-425
: The addition of theDORMANT
alert definition with high severity and specific rule configurations is well-implemented to enhance monitoring of dormant accounts.services/workflows-service/src/alert/alert.service.intg.test.ts (5)
11-11
: Updated import statements to includecleanupDatabase
.Ensure that the new
cleanupDatabase
function is implemented correctly and tested.
27-27
: Added import forAsyncFunction
from 'type-fest/source/async-return-type'.Verify that
AsyncFunction
is utilized appropriately in the tests to handle asynchronous operations.
54-54
: Enhanced database cleanup process inbeforeEach
block.Ensure that the additional cleanup commands do not affect the performance of the test suite negatively.
87-169
: Added new test suite for the 'DORMANT' rule.Ensure comprehensive coverage for the 'DORMANT' rule, including edge cases not currently tested.
1032-1063
: RefactoredcreateCounterparty
function to handle optional project parameter.Ensure that the refactoring handles cases where no project is provided and that related unit tests are updated accordingly.
services/workflows-service/src/alert/alert.service.intg.test.ts
Outdated
Show resolved
Hide resolved
services/workflows-service/src/alert/alert.service.intg.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- services/workflows-service/scripts/alerts/generate-alerts.ts (1 hunks)
- services/workflows-service/src/alert/alert.service.intg.test.ts (6 hunks)
- services/workflows-service/src/data-analytics/data-analytics.service.ts (2 hunks)
- services/workflows-service/src/data-analytics/types.ts (5 hunks)
Files skipped from review as they are similar to previous changes (3)
- services/workflows-service/scripts/alerts/generate-alerts.ts
- services/workflows-service/src/data-analytics/data-analytics.service.ts
- services/workflows-service/src/data-analytics/types.ts
Additional comments not posted (3)
services/workflows-service/src/alert/alert.service.intg.test.ts (3)
58-58
: EnsurecleanupDatabase
is necessary.The
cleanupDatabase
function is used to clean the database before each test. Verify that this function is necessary and correctly implemented to avoid potential issues with test isolation.
29-31
: Type definition looks good.The
AsyncTransactionFactoryCallback
type definition is correct and appropriately used in the file.
1256-1287
: Helper function implementation looks good.The
createCounterparty
helper function is correctly implemented and necessary for the tests.
services/workflows-service/src/alert/alert.service.intg.test.ts
Outdated
Show resolved
Hide resolved
services/workflows-service/src/alert/alert.service.intg.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- services/workflows-service/src/alert/alert.service.intg.test.ts (7 hunks)
Files skipped from review as they are similar to previous changes (1)
- services/workflows-service/src/alert/alert.service.intg.test.ts
PR Type
enhancement, bug_fix
Description
Changes walkthrough 📝
generate-alerts.ts
Add new 'DORMANT' alert definition
services/workflows-service/scripts/alerts/generate-alerts.ts
description.
target 'counterpartyId'.
HttpExceptions.filter.ts
Improve type safety in HttpExceptions filter
services/workflows-service/src/common/filters/HttpExceptions.filter.ts
for better type safety.
data-analytics.service.ts
Support 'evaluateDormantAccount' in DataAnalyticsService
services/workflows-service/src/data-analytics/data-analytics.service.ts
specific project IDs.
efficiency.
types.ts
Update type definitions for 'evaluateDormantAccount'
services/workflows-service/src/data-analytics/types.ts
function.
transaction-factory.ts
Enhance transaction date generation in tests
services/workflows-service/src/transaction/test-utils/transaction-factory.ts
dates for testing.
alert.service.intg.test.ts
Integrate tests for 'DORMANT' alert rule
services/workflows-service/src/alert/alert.service.intg.test.ts
isolation.
generation under various conditions.
Summary by CodeRabbit
New Features
Enhancements
Refactor