관리자 관리 수정

This commit is contained in:
2025-12-12 17:18:14 +09:00
parent 61255b4602
commit 41f7afca96
20 changed files with 179 additions and 145 deletions

View File

@@ -435,23 +435,38 @@ public class GlobalExceptionHandler {
}
@ExceptionHandler(CustomApiException.class)
public ResponseEntity<ApiResponseDto<String>> handleCustomApiException(
public ApiResponseDto<String> handleCustomApiException(
CustomApiException e, HttpServletRequest request) {
log.warn("[CustomApiException] resource : {}", e.getMessage());
String codeName = e.getCodeName();
HttpStatus status = e.getStatus();
String message = e.getMessage() == null ? ApiResponseCode.getMessage(codeName) : e.getMessage();
ApiResponseCode apiCode = ApiResponseCode.getCode(codeName);
// String message = e.getMessage() == null ? ApiResponseCode.getMessage(codeName) :
// e.getMessage();
//
// ApiResponseCode apiCode = ApiResponseCode.getCode(codeName);
//
// ErrorLogEntity errorLog =
// saveErrorLogData(
// request, apiCode, status, ErrorLogDto.LogErrorLevel.WARNING, e.getStackTrace());
//
// ApiResponseDto<String> body =
// ApiResponseDto.createException(apiCode, message, status, errorLog.getId());
ErrorLogEntity errorLog =
saveErrorLogData(
request, apiCode, status, ErrorLogDto.LogErrorLevel.WARNING, e.getStackTrace());
request,
ApiResponseCode.getCode(codeName),
HttpStatus.valueOf(status.value()),
ErrorLogDto.LogErrorLevel.WARNING,
e.getStackTrace());
ApiResponseDto<String> body =
ApiResponseDto.createException(apiCode, message, status, errorLog.getId());
return ApiResponseDto.createException(
ApiResponseCode.getCode(codeName),
ApiResponseCode.getMessage(codeName),
HttpStatus.valueOf(status.value()),
errorLog.getId());
return new ResponseEntity<>(body, status);
// return new ResponseEntity<>(body, status);
}
}

View File

@@ -54,6 +54,8 @@ public class SecurityConfig {
// ADMIN, REVIEWER 접근
.requestMatchers("/api/test/review")
.hasAnyRole("ADMIN", "REVIEWER")
.requestMatchers("/error")
.permitAll()
.requestMatchers(HttpMethod.OPTIONS, "/**")
.permitAll() // preflight 허용
.requestMatchers(