Add endpoints and schema for history retrieval by UUID
Introduced a new API endpoint to fetch all punishment history for a specified UUID. Updated existing schemas, controllers, and mappers to support this functionality. Adjusted login endpoints to improve request handling and streamlined frontend form setup for appeals.
This commit is contained in:
+18
@@ -153,6 +153,24 @@ public class HistoryApiController implements HistoryApi {
|
||||
return ResponseEntity.ok().body(searchResultCountCompletableFuture.join());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<PunishmentHistoryListDto> getAllHistoryForUUID(String uuid) {
|
||||
PunishmentHistoryListDto punishmentHistoryList = new PunishmentHistoryListDto();
|
||||
CompletableFuture<List<HistoryRecord>> historyRecordsCompletableFuture = new CompletableFuture<>();
|
||||
Connection.getConnection(Databases.LITE_BANS).runQuery(sqlSession -> {
|
||||
log.debug("Loading all history for uuid {}", uuid);
|
||||
try {
|
||||
List<HistoryRecord> punishments = sqlSession.getMapper(UUIDHistoryMapper.class)
|
||||
.getAllHistoryForUUID(UUID.fromString(uuid));
|
||||
historyRecordsCompletableFuture.complete(punishments);
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to load all history for uuid {}", uuid, e);
|
||||
historyRecordsCompletableFuture.completeExceptionally(e);
|
||||
}
|
||||
});
|
||||
return mapPunishmentHistory(punishmentHistoryList, historyRecordsCompletableFuture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<PunishmentHistoryDto> getHistoryById(String type, Integer id) {
|
||||
HistoryType historyTypeEnum = HistoryType.getHistoryType(type);
|
||||
|
||||
@@ -2,9 +2,6 @@ package com.alttd.altitudeweb.controllers.login;
|
||||
|
||||
import com.alttd.altitudeweb.api.LoginApi;
|
||||
import com.alttd.altitudeweb.controllers.limits.RateLimit;
|
||||
import com.alttd.altitudeweb.model.AddLoginDto;
|
||||
import com.alttd.altitudeweb.model.LoginDataDto;
|
||||
import com.alttd.altitudeweb.model.LoginResultDto;
|
||||
import org.springframework.http.HttpStatusCode;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -17,13 +14,13 @@ public class LoginController implements LoginApi {
|
||||
|
||||
@RateLimit(limit = 100, timeValue = 1, timeUnit = TimeUnit.MINUTES, key = "addLogin")
|
||||
@Override
|
||||
public ResponseEntity<Void> addLogin(AddLoginDto addLoginDto) {
|
||||
public ResponseEntity<String> requestLogin(String uuid) throws Exception {
|
||||
throw new ResponseStatusException(HttpStatusCode.valueOf(501), "Adding login is not yet supported");
|
||||
}
|
||||
|
||||
@RateLimit(limit = 5, timeValue = 1, timeUnit = TimeUnit.MINUTES, key = "login")
|
||||
@Override
|
||||
public ResponseEntity<LoginResultDto> login(LoginDataDto loginDataDto) {
|
||||
public ResponseEntity<String> login(String code) {
|
||||
throw new ResponseStatusException(HttpStatusCode.valueOf(501), "Logging in is not yet supported");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user