-
Notifications
You must be signed in to change notification settings - Fork 199
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
blokh/feat/business report alerts #2311
Conversation
|
WalkthroughThe recent updates introduce several key enhancements to the workflows service. Notably, the 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 (fa0dd21) |
1 similar comment
PR Description updated to latest commit (fa0dd21) |
PR Review(Review updated until commit dc05878)
Code feedback:
✨ Review tool usage guide:Overview: The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.
See the review usage page for a comprehensive guide on using this tool. |
Persistent review updated to latest commit fa0dd21 |
PR Code Suggestions
✨ Improve tool usage guide:Overview:
See the improve usage page for a comprehensive guide on using this tool. |
PR Code Suggestions
✨ Improve tool usage guide:Overview:
See the improve usage page for a comprehensive guide on using this tool. |
…:ballerine-io/ballerine into blokh/feat/add-business-report-report-id
services/workflows-service/src/workflow/hook-callback-handler.service.ts
Outdated
Show resolved
Hide resolved
services/workflows-service/src/workflow/hook-callback-handler.service.ts
Show resolved
Hide resolved
PR Description updated to latest commit (dc05878) |
Persistent review updated to latest commit dc05878 |
PR Code Suggestions
✨ Improve tool usage guide:Overview:
See the improve usage page for a comprehensive guide on using this tool. |
# Conflicts: # services/workflows-service/prisma/data-migrations # services/workflows-service/src/business-report/business-report.repository.ts
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
Out of diff range and nitpick comments (1)
services/workflows-service/src/workflow/cron/ongoing-monitoring.cron.ts (1)
74-74
: Logging level change approved; consider enhancing the log message.The change in logging level from error to debug is appropriate if the scenario is non-critical. However, consider adding more details to the log message to aid in debugging, such as the business name or other identifiers.
# Conflicts: # services/workflows-service/prisma/data-migrations
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: 4
Outside diff range and nitpick comments (1)
services/workflows-service/src/alert/alert.service.ts (1)
82-82
: Consider adding type annotations toargs
for better type safety and code readability.
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!pnpm-lock.yaml
Files selected for processing (3)
- services/workflows-service/scripts/alerts/generate-alerts.ts (11 hunks)
- services/workflows-service/src/alert/alert.service.ts (8 hunks)
- services/workflows-service/src/alert/consts.ts (1 hunks)
Files not reviewed due to errors (1)
- services/workflows-service/scripts/alerts/generate-alerts.ts (no review received)
Files skipped from review as they are similar to previous changes (1)
- services/workflows-service/src/alert/consts.ts
Additional comments not posted (1)
services/workflows-service/src/alert/alert.service.ts (1)
Line range hint
292-309
: Ensure thatcreateAlert
method properly handles the case wheresubject
is empty.Verification successful
The
createAlert
method usesObject.assign({}, ...(subject || []))
to handle thesubject
parameter. This approach ensures that ifsubject
is empty or undefined, it will default to an empty object, thus preventing any errors.
subject || []
ensures that ifsubject
is falsy (e.g.,null
orundefined
), it will be replaced with an empty array.Object.assign({}, ...[])
will result in an empty object if the array is empty.This implementation correctly handles the case where
subject
is empty.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify handling of empty `subject` in `createAlert`. # Test: Search for error handling related to empty `subject`. rg --type typescript 'createAlert' 'services/workflows-service/src/alert/alert.service.ts'Length of output: 123
Script:
#!/bin/bash # Description: Verify handling of empty `subject` in `createAlert`. # Correct the file type and search for the `createAlert` method. rg 'createAlert' 'services/workflows-service/src/alert/alert.service.ts'Length of output: 376
Script:
#!/bin/bash # Description: Extract the implementation of the `createAlert` method to verify handling of empty `subject`. # Extract the `createAlert` method implementation. ast-grep --lang typescript --pattern $'class $_ { $$$ private createAlert($_, $_, $_) { $$$ } $$$ }' 'services/workflows-service/src/alert/alert.service.ts'Length of output: 169
Script:
#!/bin/bash # Description: Extract the implementation of the `createAlert` method to verify handling of empty `subject`. # Search for the `createAlert` method definition and extract surrounding lines. rg -A 20 'private createAlert' 'services/workflows-service/src/alert/alert.service.ts'Length of output: 798
Co-authored-by: Lior Zamir <[email protected]>
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: 2
Outside diff range and nitpick comments (2)
services/workflows-service/src/alert-definition/alert-definition.repository.ts (1)
14-17
: Consider adding a comment explaining the use ofprojectIds
for clarity.services/workflows-service/src/alert/alert.service.ts (1)
Line range hint
82-100
: The inclusion ofmonitoringType
directly in the query enhances specificity and efficiency. Consider adding a comment to explain its usage for future maintainers.
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- services/workflows-service/src/alert-definition/alert-definition.repository.ts (3 hunks)
- services/workflows-service/src/alert/alert.service.ts (9 hunks)
- services/workflows-service/src/data-analytics/data-analytics.service.ts (4 hunks)
Files skipped from review as they are similar to previous changes (1)
- services/workflows-service/src/data-analytics/data-analytics.service.ts
Additional comments not posted (5)
services/workflows-service/src/alert-definition/alert-definition.repository.ts (4)
14-17
: The updated method signature and the use of scoped query are consistent with multi-tenant application requirements.
52-59
: Dynamic ordering via theorderBy
parameter enhances flexibility in data retrieval.
62-64
: The method signature update is consistent and well-implemented.
90-92
: Enhanced flexibility in thedeleteById
method through the inclusion of additional arguments is a positive change.services/workflows-service/src/alert/alert.service.ts (1)
127-129
: Filtering alert definitions bymonitoringType
is an effective and relevant addition.
User description
feat: updated callback to ongoing to format response for each report
Type
enhancement
Description
findFirst
methods in bothBusinessReportRepository
andBusinessReportService
to enhance data retrieval.HookCallbackHandlerService
with Zod validation and additional logic for handling comparison reports.reportId
field and index in theBusinessReport
table.Changes walkthrough
business-report.repository.ts
Add findFirst Method in BusinessReportRepository
services/workflows-service/src/business-report/business-report.repository.ts
findFirst
to fetch the first business report withenhanced scoping.
business-report.service.ts
Implement findFirst Method in BusinessReportService
services/workflows-service/src/business-report/business-report.service.ts
findFirst
to retrieve the first businessreport.
hook-callback-handler.service.ts
Enhance Data Handling and Validation in HookCallbackHandlerService
services/workflows-service/src/workflow/hook-callback-handler.service.ts
prepareMerchantAuditReportContext
.prepareMerchantAuditReportContext
.prepareMerchantAuditReportContext
toinclude
reportId
.migration.sql
SQL Migration to Add reportId to BusinessReport
services/workflows-service/prisma/migrations/20240421105728_add_business_report_report_id/migration.sql
reportId
to theBusinessReport
table.reportId
column.schema.prisma
Update Prisma Schema with reportId in BusinessReport
services/workflows-service/prisma/schema.prisma
reportId
field to theBusinessReport
model.reportId
field.data-migrations
Update Data Migrations Submodule Reference
services/workflows-service/prisma/data-migrations
Summary by CodeRabbit
New Features
riskScore
field to business reports for enhanced risk assessment.MonitoringType
for better alert categorization.Improvements
Bug Fixes
Dependencies