From 3488cd75dea9c144e06bc37741673f9878aaddc5 Mon Sep 17 00:00:00 2001 From: F-G Fernandez <26927750+frgfm@users.noreply.github.com> Date: Mon, 15 Jul 2024 12:33:46 +0200 Subject: [PATCH] docs(uml): add organization to DB UML (#348) * docs(uml): update the UML of the DB * docs(contributing): update UML image * ci(labeler): update labeler rule * ci(labeler): add diagram update to topic docs --- .github/labeler.yml | 21 +++++++++++++++++---- CONTRIBUTING.md | 2 +- scripts/dbdiagram.txt | 10 ++++++++++ 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index b03b5001..d76c1e2e 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -42,15 +42,19 @@ 'module: crud': - changed-files: - - any-glob-to-any-file: src/app/crud/* + - any-glob-to-any-file: src/app/crud/base.py 'endpoint: cameras': - changed-files: - - any-glob-to-any-file: src/app/api/*/endpoints/cameras.py + - any-glob-to-any-file: + - src/app/api/*/endpoints/cameras.py + - src/app/crud/cameras.py 'endpoint: detections': - changed-files: - - any-glob-to-any-file: src/app/api/*/endpoints/detections.py + - any-glob-to-any-file: + - src/app/api/*/endpoints/detections.py + - src/app/crud/detections.py 'endpoint: login': - changed-files: @@ -58,7 +62,15 @@ 'endpoint: users': - changed-files: - - any-glob-to-any-file: src/app/api/*/endpoints/users.py + - any-glob-to-any-file: + - src/app/api/*/endpoints/users.py + - src/app/crud/users.py + +'endpoint: organizations': +- changed-files: + - any-glob-to-any-file: + - src/app/api/*/endpoints/organizations.py + - src/app/crud/organizations.py 'topic: build': @@ -94,6 +106,7 @@ - CODE_OF_CONDUCT.md - client/README.md - client/CONTRIBUTING.md + - scripts/dbdiagram.txt 'topic: style': - changed-files: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c30815bc..9608df5b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,7 +18,7 @@ The back-end core feature is to interact with the metadata tables. For the servi - Detection: association of a picture and a camera. -![UML diagram](https://github.com/pyronear/pyro-api/assets/26927750/bf48f757-7cb0-45fd-aea1-b832e969a705) +![UML diagram](https://github.com/user-attachments/assets/cd45d9e3-c570-4d84-95b9-7a8c5ae00af0) ### What is the full detection workflow through the API diff --git a/scripts/dbdiagram.txt b/scripts/dbdiagram.txt index ea2ce5cb..973536ff 100644 --- a/scripts/dbdiagram.txt +++ b/scripts/dbdiagram.txt @@ -7,6 +7,7 @@ Enum "userrole" { Table "User" as U { "id" int [not null] + "organization_id" int [ref: > O.id, not null] "role" userrole [not null] "login" str [not null] "hashed_password" str [not null] @@ -18,6 +19,7 @@ Table "User" as U { Table "Camera" as C { "id" int [not null] + "organization_id" int [ref: > O.id, not null] "name" str [not null] "angle_of_view" float [not null] "elevation" float [not null] @@ -43,3 +45,11 @@ Table "Detection" as D { (id) [pk] } } + +Table "Organization" as O { + "id" int [not null] + "name" str [not null] + Indexes { + (id) [pk] + } +}