Comments und add licence

This commit is contained in:
Carsten Graf
2025-07-12 17:39:45 +02:00
parent 585d2d7d5d
commit d10a8fef6d
11 changed files with 126 additions and 34 deletions

View File

@@ -41,8 +41,8 @@ struct UserData {
bool exists;
};
// UserData checkUser(const String& uid) is defined only once to avoid
// redefinition errors.
// Prüft, ob ein Benutzer mit der angegebenen UID in der Datenbank existiert und
// gibt dessen Daten zurück.
UserData checkUser(const String &uid) {
UserData userData = {"", "", "", 0, false};
@@ -85,7 +85,7 @@ UserData checkUser(const String &uid) {
return userData;
}
// Function to enter user data into the database
// Fügt einen neuen Benutzer mit den angegebenen Daten in die Datenbank ein.
bool enterUserData(const String &uid, const String &firstname,
const String &lastname, const String &geburtsdatum,
int alter) {
@@ -123,6 +123,7 @@ bool enterUserData(const String &uid, const String &firstname,
}
}
// Holt alle Standorte aus der Datenbank und gibt sie als JSON-Dokument zurück.
JsonDocument getAllLocations() {
JsonDocument locations; // Allocate memory for the JSON document
@@ -152,11 +153,12 @@ JsonDocument getAllLocations() {
return locations; // Return the populated JSON document
}
// Keep this for backward compatibility
// Prüft, ob ein Benutzer mit der angegebenen UID existiert
// (Kompatibilitätsfunktion).
bool userExists(const String &uid) { return checkUser(uid).exists; }
// Routes from the Frontend into here and then into DB backend.
// Richtet die HTTP-Routen für die Backend-API ein (z.B. Health-Check, User- und
// Location-Abfragen).
void setupBackendRoutes(AsyncWebServer &server) {
server.on("/api/health", HTTP_GET, [](AsyncWebServerRequest *request) {