32 lines
1.5 KiB
Markdown
32 lines
1.5 KiB
Markdown
# Visione Database Schema
|
|
|
|
The schema is stored in ordered SQL migrations under `migrations/`.
|
|
|
|
Persistence currently uses `drogon::orm::DbClient` with raw parameterized SQL.
|
|
The project does not use Drogon generated models or `Mapper<T>` while the schema
|
|
is still evolving.
|
|
|
|
Important tables:
|
|
|
|
- `users`: identity, personal data, password hash, points and moderation flags.
|
|
- `roles`, `permissions`, `role_permissions`, `user_roles`: authorization.
|
|
- `otp_challenges`: local OTP login flow.
|
|
- `api_tokens`: bearer tokens for the local API.
|
|
- `report_categories`: report classification.
|
|
- `areas`: named city areas with GeoJSON polygon boundaries.
|
|
- `team_categories`, `teams`: municipal intervention teams.
|
|
- `reports`: citizen reports with coordinates, address, status, area and assigned operator.
|
|
- `report_status_history`: immutable status transition log.
|
|
- `assignments`: report-to-team assignment history.
|
|
- `report_photos`: uploaded report media URL, original filename, content type,
|
|
media kind and size. The table name is historical; rows can be images or videos.
|
|
- `messages`: citizen/operator report conversation.
|
|
- `feedback`: citizen rating and comment after resolution.
|
|
- `reward_events`: indirect gamification points ledger.
|
|
- `notifications`: local in-app notifications for status changes, messages and
|
|
reward events.
|
|
- `moderation_flags`: report/message review queue for abusive or invalid content.
|
|
|
|
GeoJSON is intentionally used instead of MySQL Spatial in milestone 1 to keep
|
|
the local setup simple and portable.
|