rowt/doc/db/README.md

59 lines
2.2 KiB
Markdown
Raw Normal View History

2024-10-08 10:06:29 +02:00
# Database
Since the database stabilized quite well over the last months/years, hopefully it will not change that much in the future.
Thus, here is the current (October '24) model and the reasoning behind it:
2024-10-08 10:09:12 +02:00
## User
2024-10-08 10:06:29 +02:00
![](./user.svg)
- All user-relevant fields are stored in `User`.
- `Role` (and its associative table `UserRole`) map current roles the user has. This is used for e.g. permissions (`Vorstand`, `Admin`, `cox`, ... roles) and fee calculation (`Donau Linz`, `scheckbuch`, `Rennjugend`).
- `Family` specifies, well, a family. Currently only used for fee calculation.
2024-10-08 10:09:12 +02:00
## Planned rowing adventures :-)
2024-10-08 10:06:29 +02:00
![](./planned.svg)
There are 2 main types:
2024-10-08 10:07:34 +02:00
2024-10-08 10:08:06 +02:00
1. **Trips:** Trips can be created by every cox. They are "simple", every-day trips.
2. **Events:** Events can be created by everyone who has the `manage_events` role. They are used if multiple coxes are needed, e.g. for "Fetzenfahrt", "Anrudern", .... Additionally, events are shown in public calendar (e.g. on the website).
2024-10-08 10:06:29 +02:00
`TripDetails` extracts the common data for both Trips and Events.
Rower can register using the `UserTrip` table.
This table expects either...
2024-10-08 10:07:34 +02:00
2024-10-08 10:08:06 +02:00
- a `user_id`, if a person who has an account registers to the trip/event
- a `user_note`, if the cox of a trip, or a `manage_events` user of an event wants to add a guest which has no account
2024-10-08 10:06:29 +02:00
2024-10-08 10:09:12 +02:00
## Logbook
2024-10-08 10:06:29 +02:00
![](./logbook.svg)
If `arrival` is NULL, the boat is assumed to still be on the water.
There are a few `LogbookType`s:
2024-10-08 10:07:34 +02:00
2024-10-08 10:06:29 +02:00
- `Wanderfahrt`: Used to check if a user has accomplished their `Fahrtenabzeichen` in the current year.
- `Regatta`
If the number of users entered is less than the boat's maximum capacity, the remaining spaces will be automatically assigned to guests.
2024-10-08 10:09:12 +02:00
## Boat
2024-10-08 10:06:29 +02:00
![](./boat.svg)
2024-10-08 10:09:12 +02:00
## Trailer
2024-10-08 10:06:29 +02:00
![](./trailer.svg)
2024-10-08 10:09:12 +02:00
## Fetching
2024-10-08 10:06:29 +02:00
![](./fetching.svg)
This tables are used to automatically fetch data (every hour). Currently we have:
2024-10-08 10:07:34 +02:00
2024-10-08 10:06:29 +02:00
- `Waterlevel` which fetches the current waterlevel in Linz from hydro (with their explicit permission :-))
- `Weather` weather data from *Open Weather*
2024-10-08 10:09:12 +02:00
## Misc
2024-10-08 10:06:29 +02:00
![](./misc.svg)
- **Log:** Logs "interesting" activities, to be viewed in the web ui
- **Notification**
- **Distance:** Default distances of certain common targets