feat(notifications): add API routes for rules and history (PR 2 of #254)#453
Open
Pragati5-DEBUG wants to merge 1 commit into
Open
feat(notifications): add API routes for rules and history (PR 2 of #254)#453Pragati5-DEBUG wants to merge 1 commit into
Pragati5-DEBUG wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is PR 2 of 5 for #254 (notification channels for high/critical findings).
PR 1 added the database schema and Pydantic models. This PR adds the REST API to manage notification rules and read delivery history.
New endpoints:
GET /api/v1/notifications/rules — list all rules
POST /api/v1/notifications/rules — create a rule
GET /api/v1/notifications/rules/{id} — get one rule
PATCH /api/v1/notifications/rules/{id} — update a rule
DELETE /api/v1/notifications/rules/{id} — delete a rule
GET /api/v1/notifications/history — list delivery history (?rule_id=, ?limit=, ?offset=)
Also includes:
NotificationRuleUpdate model for partial PATCH updates
Webhook URL and email validation before saving
Integration tests for CRUD, validation, and history listing
Planned order (PR 2 of 5):
DB schema + models ✅ merged
API routes ← this PR
Notification service (webhook/email, dedupe, redaction)
Executor hook (trigger after scan)
Settings UI
No actual notification sending in this PR — routes and validation only.
Hi @utksh1 — continuing the split from #360. Please review when you can.
Related Issues
#254
Related to closed #360 (split into smaller PRs)
Type of Change
New feature (non-breaking change which adds functionality)
Documentation update
How Has This Been Tested?
.\venv\Scripts\python.exe -m pytest testing/backend/integration/test_notification_routes.py -v
4 integration tests pass
CRUD flow, invalid webhook rejection, email target, history list with rule_id filter
ruff check backend testing/backend passes
Checklist
My code follows the code style of this project.
I have performed a self-review of my own code.
My changes generate no new warnings.