pyronear / pyro-api

Alert Management API for wildfire prevention, detection & monitoring. Built with FastAPI & PostgreSQL
Apache License 2.0
21 stars 9 forks source link

feat(webhooks): add webhook mechanism on detection creation #367

Closed frgfm closed 1 month ago

frgfm commented 2 months ago

This PR adds a small webhook table, and used when detection are created as background tasks. I made webhooks editable only by admins, and they post the detection payload for now. We'll be able to edit what gets sent upon dispatch later if needed

Here is the new UML: UML diagram

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 82.85714% with 12 lines in your changes missing coverage. Please review.

Project coverage is 86.19%. Comparing base (92b9e28) to head (bd58f3d). Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/app/api/dependencies.py 53.33% 7 Missing :warning:
src/app/api/api_v1/endpoints/detections.py 44.44% 5 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #367 +/- ## ========================================== - Coverage 86.58% 86.19% -0.39% ========================================== Files 31 34 +3 Lines 857 920 +63 ========================================== + Hits 742 793 +51 - Misses 115 127 +12 ``` | [Flag](https://app.codecov.io/gh/pyronear/pyro-api/pull/367/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pyronear) | Coverage Δ | | |---|---|---| | [backend](https://app.codecov.io/gh/pyronear/pyro-api/pull/367/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pyronear) | `85.79% <82.85%> (-0.39%)` | :arrow_down: | | [client](https://app.codecov.io/gh/pyronear/pyro-api/pull/367/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pyronear) | `91.80% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pyronear#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.