Skip to content

feat(notifications): add API routes for rules and history (PR 2 of #254)#453

Open
Pragati5-DEBUG wants to merge 1 commit into
utksh1:mainfrom
Pragati5-DEBUG:feat/254-notification-routes-pr2
Open

feat(notifications): add API routes for rules and history (PR 2 of #254)#453
Pragati5-DEBUG wants to merge 1 commit into
utksh1:mainfrom
Pragati5-DEBUG:feat/254-notification-routes-pr2

Conversation

@Pragati5-DEBUG
Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant