Add endpoint to determine if there are active notifications#596
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
There was a problem hiding this comment.
Pull Request Overview
Add a new endpoint and related plumbing to fetch active notification statuses for a set of node IDs.
- Introduce
NotificationStatusWeband a Wasm-bindingactive_notifications_for_node_idsmethod in the frontend crate. - Declare and implement transport and persistence APIs for fetching active-status by node IDs, including DB query logic and unit tests.
- Update JS UI and CHANGELOG to expose and document the new endpoint.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/bcr-ebill-wasm/src/data/notification.rs | Added NotificationStatusWeb struct for the new endpoint |
| crates/bcr-ebill-wasm/src/api/notification.rs | Added active_notifications_for_node_ids Wasm API method |
| crates/bcr-ebill-wasm/main.js | Registered getActiveNotif handler for the new button |
| crates/bcr-ebill-wasm/index.html | Added button to trigger the new endpoint |
| crates/bcr-ebill-transport/src/notification_service.rs | Declared transport trait method for active-status lookup |
| crates/bcr-ebill-transport/src/handler/mod.rs | Added store API signature for get_active_status_for_node_ids |
| crates/bcr-ebill-persistence/src/notification.rs | Extended persistence trait with active-status method |
| crates/bcr-ebill-persistence/src/db/notification.rs | Implemented DB query for active-status and added tests |
| crates/bcr-ebill-api/src/tests/mod.rs | Updated API mock to include new store method |
| crates/bcr-ebill-api/src/service/notification_service/default_service.rs | Implemented the new service method get_active_notificattion_status_for_node_ids |
| CHANGELOG.md | Documented the new API endpoint |
Comments suppressed due to low confidence (2)
crates/bcr-ebill-api/src/service/notification_service/default_service.rs:753
- There are no unit tests for this service-level method. Add tests to verify that it correctly forwards results from the store and handles errors to prevent regressions.
async fn get_active_notificattion_status_for_node_ids(
crates/bcr-ebill-persistence/src/db/notification.rs:58
- The
format!macro includes a{node_id_filter}placeholder without a corresponding argument, causing a compile error. Useformat!("... {} ...", node_id_filter)or named arguments ({node_id_filter} = node_id_filter).
let result: Vec<NodeIdDb> = self.db.query(&format!("SELECT node_id from notifications where active = true {node_id_filter} GROUP BY node_id"), bindings).await?;
PR Code Suggestions ✨Latest suggestions up to 2bb3d99
Previous suggestionsSuggestions up to commit d62a355
|
||||||||||||||||||||||||||||
d62a355 to
2bb3d99
Compare
2bb3d99 to
069031e
Compare
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
User description
📝 Description
Relates to #589
✅ Checklist
Please ensure the following tasks are completed before requesting a review:
cargo fmt.cargo clippy.🚀 Changes Made
See above.
💡 How to Test
Please provide clear instructions on how reviewers can test your changes:
🤝 Related Issues
List any related issues, pull requests, or discussions:
📋 Review Guidelines
Please focus on the following while reviewing:
PR Type
Enhancement
Description
Add endpoint to check active notification status for node IDs
Implement database query for active notification lookup
Add WASM API binding for frontend integration
Include comprehensive test coverage for new functionality
Diagram Walkthrough
File Walkthrough
8 files
Add service method for active notification statusImplement database query for active notification lookupAdd trait method for active status retrievalAdd transport trait method definitionAdd WASM API endpoint for notification statusAdd web data structure for notification statusAdd frontend button for testing new endpointAdd UI button for notification status testing2 files
Update mock traits with new method signatureUpdate transport mock with new method1 files
Document new API call functionality