-
Notifications
You must be signed in to change notification settings - Fork 0
Database Layer
If you want to understand the database structure, go here.
The Database Layer is, as the name indicates, a layer between the API and the database.
Its main purpose is to store data to and retrieve it from the database.
Serlo's DB Layer is written in Rust using the popular web server framework actix for handling the requests and sqlx for communicating with a MySQL database. It also uses extensively serde.rs.
As in every Rust app, it begins in main.rs, where the app is configured and started. Differently to usual web servers and inspired by GraphQL, the DB layer has just one "relevant" endpoint.
Each payload it receives should conform one of the supported messages. For example, a payload about the Serlo's uuids should have the fields "type" and "payload", like
{
"type": "UuidQuery",
"payload": {
"id": 1
}
}
If we had wrongly written instead of 'UuidQuery' 'IdQuery' or instead of 'id' 'uuid' we would have gotten Json deserialize error: data did not match any variant of untagged enum Message
.
Once the payload is correct, it calls the corresponding method which in turn gives back a response that is going to be translated into a actix http response.
TODO:
- explain how it connects to the database
- explain operation
- explain events
- note on the custom datetime
- Home
- Serlo Infrastructure
- Serlo Infrastructure for Non programmers
- Resources for new programmers
- Setup of the toolchain
- Best Practices
- How Tos
- Single Sign On
- Integration with the Data Wallet
- User Journey
- Integration of "Datenraum" into the Serlo Editor
- Introduction to the Serlo editor
- Core concepts of the Serlo editor
- Packages of the Serlo editor
- Creating a new plugin (outdated)
- Redux process in the Serlo editor
- The content format of the Serlo editor
- How the Serlo Editor is integrated into edu-sharing via LTI