-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat: send notifications when an alert is received #272
Conversation
- send and log a notification message via email (or another type, to be implemented) to the recipients subscribed to a group - add tables and routes: notifications and recipients - allow python >= 3.8, <4 ; update poetry.lock
# Conflicts: # poetry.lock # pyproject.toml # src/app/models/alert.py
# Conflicts: # src/app/api/crud/alerts.py # src/app/api/crud/authorizations.py # src/app/models/alert.py # src/app/schemas/base.py # src/app/schemas/devices.py # src/app/schemas/events.py # src/app/schemas/installations.py # src/app/schemas/sites.py
Nice of you to open a PR 🙏 |
Codecov Report
@@ Coverage Diff @@
## main #272 +/- ##
===========================================
- Coverage 100.00% 95.35% -4.65%
===========================================
Files 3 66 +63
Lines 74 1571 +1497
===========================================
+ Hits 74 1498 +1424
- Misses 0 73 +73
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/quack review |
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.
Thanks for the PR 🙏
Other sections
src/app/models/recipient.py:L23
src/app/models/recipient.py:L17
src/app/schemas/notifications.py:L11
src/app/schemas/recipients.py:L12
src/app/models/notification.py:L16
src/app/models/notification.py:L15
src/app/api/endpoints/notifications.py:L17
src/app/services/utils.py:L28
src/app/services/utils.py:L48
src/app/api/endpoints/recipients.py:L16
For a better experience, it's recommended to check the review comments in the tab Files Changed.
Feedback is a gift! Quack will adjust your review style when you add reactions to a review comment
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.
Hello Bruno, Thanks a lot for this such useful feature !
Just a few questions and remarks before approving !
Once it is deployed, we can close #263 |
Sorry I wasn't available to review here! Meaning the webhooks would be a content (Telegram msg + recipient) and a destination (Telegram API). And in that regard, I would argue we don't need the notifications table (we could get the timestamp of an alert or add a "notification_sent_at" column) and I think the recipient table could be put in the webhook if we do this correctly. Not a problem, but perhaps it would be helpful to consider that for the tables. The more we have, the bigger the DB, the slower the API & the tests, and the more we have to maintained 🙃 Happy to discuss this a bit later! |
With this PR, a notification message is sent when the first alert in each event is created. The notification is sent via telegram (or another type, to be implemented if needed) to the recipients subscribed and associated to a group, and logged in the db.