👩🚒 SENAC Brigade#
Architecture#

Routes#
| Route | Description | Method |
|---|---|---|
| /admin/setup | Create the first admin user | POST (JSON) |
| /admin/signup | Register a new user account | POST (Form) |
| /admin/users | List all registred users | GET |
| /admin/users/{{id}} | Delete an user from the DataBase | DELETE |
| /admin/users/{{id}} | Update the user data as an admin | PUT (JSON) |
| /admin/users/{{id}}/status | Update the status of a user account | PUT (JSON) |
| /admin/teams | Register a new brigade, with a leader and all their members | POST (Form) |
| /admin/teams | Query all registered brigades | GET |
| /admin/teams/{{id}}/status | Update the status of a brigade | PUT (JSON) |
| /admin/teams/{{id}} | Remove a brigade | DELETE |
| /user/login | Login with your user account | POST (Form) |
| /user/profile | Retrieve data about the authenticated user | GET |
| /user/profile | Update your profile | PUT(JSON) |
| /user/roles | Get a list of all available roles | GET |
| /user/{{id}}/occurrences | Find all occurrences applied by this user | GET |
| /user/{{id}}/crew_members | List fellow brigade members of this user | GET |
| /user/notification_preferences | Fetch authenticated user notification preferences | GET |
| /user/notification_preferences | Update authenticated user notification preferences | PUT (JSON) |
| /user/password | Update authenticated user password | PUT (JSON) |
| /brigade/{{id}}/members | List brigade members | GET |
| /dashboard/stats | Fetch stats for the dashboard page | GET |
| /analysis/occurrence | Fetch data for analysis about occurrences | GET |
| /occurrence/new | Register a new occurrence | POST (Form) |
| /occurrence/resolve/{{id}} | Update an occurrence resolved_at field |
POST / DELETE |
Entity RelationShip Diagram#
---
title: SENAC Brigade
---
erDiagram
user_account {
UUID id PK
USER_ROLE_ENUM user_role
TEXT full_name
TEXT password_hash
TEXT registration
TEXT phone
TEXT email UK
BOOLEAN is_active
TIMESTAMP created_at
TIMESTAMP updated_at
}
notification_preference ||--|{ user_account : preference
notification_preference {
UUID id PK
UUID user_id FK
NOTIFICATION_TYPE_ENUM notification_type
BOOLEAN enabled
TIMESTAMP created_at
TIMESTAMP updated_at
}
brigade }o--|{ user_account : leader_of
brigade {
UUID id PK
UUID leader_id FK
TEXT name
TEXT vehicle_code
TEXT description
BOOLEAN is_active
TIMESTAMP created_at
TIMESTAMP updated_at
}
brigade_membership }|--|{ user_account : is_member_of
brigade_membership }|--|{ brigade : is_part_of
brigade_membership {
UUID id PK
UUID user_id FK
UUID brigade_id FK
}
occurrence }o--|{ user_account : submit
occurrence {
UUID id PK
UUID applicant_id FK
OCCURRENCE_CATEGORY_ENUM category
OCCURRENCE_SUBCATEGORY_ENUM subcategory
TEXT description
POINT location
TEXT reference_point
TIMESTAMP created_at
TIMESTAMP updated_at
TIMESTAMP resolved_at
}
occurrence_brigade }|--|{ brigade : assigned_to
occurrence_brigade }|--|{ occurrence : assigned
occurrence_brigade {
UUID id PK
UUID occurrence_id FK
UUID brigade_id FK
}