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

New Data Model : Add an Organization table #332

Closed RonanMorgan closed 3 months ago

RonanMorgan commented 4 months ago

This table will be used to keep information about the owner of one or many cameras.

It will also be useful for resources access management (if you have access to the Site, you have access to all the resources linked to this site)

Pyronear UML

RonanMorgan commented 4 months ago

TODO : => add site_id in user table :heavy_check_mark: => add other CRUD functionalities for the Site endpoint and add tests for them :heavy_check_mark: => refactor Site -> Organization :heavy_check_mark: => adapt access behavior : a user can only access resources from the same site :heavy_check_mark:

=> fix e2e tests & client tests :heavy_check_mark: => improve tests coverage

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 81.35593% with 22 lines in your changes missing coverage. Please review.

Project coverage is 87.71%. Comparing base (2dcab5b) to head (10f9f7e).

Files Patch % Lines
src/app/db.py 7.69% 12 Missing :warning:
src/app/api/api_v1/endpoints/cameras.py 76.92% 3 Missing :warning:
src/app/api/api_v1/endpoints/detections.py 88.88% 3 Missing :warning:
src/app/crud/base.py 60.00% 2 Missing :warning:
client/pyroclient/client.py 50.00% 1 Missing :warning:
src/app/api/api_v1/endpoints/login.py 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #332 +/- ## ========================================== - Coverage 88.49% 87.71% -0.78% ========================================== Files 28 31 +3 Lines 643 741 +98 ========================================== + Hits 569 650 +81 - Misses 74 91 +17 ``` | [Flag](https://app.codecov.io/gh/pyronear/pyro-api/pull/332/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/332/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pyronear) | `87.33% <81.73%> (-0.67%)` | :arrow_down: | | [client](https://app.codecov.io/gh/pyronear/pyro-api/pull/332/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pyronear) | `93.47% <66.66%> (-1.88%)` | :arrow_down: | 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.

RonanMorgan commented 4 months ago

@frgfm about the pyronear org : it seems dangerous to me to say that an empty org has the admin right, it would be easy to imagine a bug conducting to the creation of an empty org that's why I don't really like this solution (but I might be wrong)

furthermore we could imagine some development resources only available to pyronear member, in this case we could also have non admin user attached to the pyronear org.

frgfm commented 3 months ago

There are still conflicts, but it's strange the last commit on main was 18hours ago, while your last push is from 12 hours ago. Are you merging the last version of main?

frgfm commented 2 months ago

cf. #304