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
@@ -13,12 +13,9 @@ public class CorsConfig implements WebMvcConfigurer {
@Value("${cors.allowed-origins}")
private String[] allowedOrigins;
public CorsConfig() {
log.info("test");
}
@Override
public void addCorsMappings(CorsRegistry registry) {
log.info("Registering CORS mappings for {}", String.join(", ", allowedOrigins));
registry.addMapping("/**")
.allowedOrigins(allowedOrigins)
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
@@ -25,7 +25,7 @@ public class TeamApiController implements TeamApi {
Connection.getConnection(Databases.LUCK_PERMS, configuration -> configuration.addMapper(TeamMemberMapper.class))
.thenApply(connection -> {
connection.runQuery(sqlSession -> {
log.info("Loading team members for group {}", group);
log.debug("Loading team members for group {}", group);
List<Player> players = sqlSession.getMapper(TeamMemberMapper.class).getTeamMembers("group." + group);
playerGroupFuture.complete(players);
});