Refactor API structure and enhance logging/debugging.

Modularized OpenAPI definitions by splitting into dedicated files for teams, bans, and errors. Improved backend logging for database connections, CORS configuration, and debugging. Updated application properties to support environment-specific CORS origins and logging levels.
This commit is contained in:
2025-04-10 21:45:00 +02:00
parent 23f298b8c9
commit 2137459e9b
10 changed files with 138 additions and 100 deletions
@@ -42,16 +42,20 @@ public class Connection {
}
CompletableFuture<DatabaseSettings> settingsFuture = new CompletableFuture<>();
getConnection(Databases.DEFAULT, (mapper -> mapper.addMapper(SettingsMapper.class))).thenApply(connection -> {
log.debug("Loading settings for database {}", database.getInternalName());
connection.runQuery(session -> {
log.debug("Running query to load settings for database");
DatabaseSettings loadedSettings = session.getMapper(SettingsMapper.class).getSettings(database.getInternalName());
if (loadedSettings == null) {
log.error("Failed to load settings for database {}", database.getInternalName());
}
log.debug("Loaded settings {}", loadedSettings);
settingsFuture.complete(loadedSettings);
});
return null;
});
return settingsFuture.thenApply(loadedSettings -> {
log.debug("Storing connection for database {}", database.getInternalName());
Connection connection = new Connection(loadedSettings, addMappers);
connections.put(database, connection);
return connection;
@@ -66,7 +70,9 @@ public class Connection {
System.getenv("DB_USER"),
System.getenv("DB_PASS")
);
log.debug("Loaded default database settings {}", databaseSettings);
Connection connection = new Connection(databaseSettings, addMappers);
log.debug("Created default database connection {}", connection);
return CompletableFuture.completedFuture(connection);
}