diff --git a/src/main/java/com/solucitation/midpoint_backend/domain/community_board/api/PostController.java b/src/main/java/com/solucitation/midpoint_backend/domain/community_board/api/PostController.java index c5b4cb3..a4af9dd 100644 --- a/src/main/java/com/solucitation/midpoint_backend/domain/community_board/api/PostController.java +++ b/src/main/java/com/solucitation/midpoint_backend/domain/community_board/api/PostController.java @@ -245,7 +245,8 @@ public ResponseEntity deletePost(@PathVariable Long postId, Authentication au return ResponseEntity.status(HttpStatus.NOT_FOUND) .body(Map.of("error", "POST_NOT_FOUND", "message", "해당 게시글이 존재하지 않습니다.")); } catch (AccessDeniedException e) { - return ResponseEntity.status(HttpStatus.FORBIDDEN).body(e.getMessage()); + return ResponseEntity.status(HttpStatus.FORBIDDEN) + .body(Map.of("error", "FORBIDDEN", "message", e.getMessage())); } catch (Exception e) { return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .body(Map.of("error", e.getMessage(), "message", "게시글 삭제 중 오류가 발생하였습니다.")); diff --git a/src/main/java/com/solucitation/midpoint_backend/domain/history2/api/SearchHistoryControllerV2.java b/src/main/java/com/solucitation/midpoint_backend/domain/history2/api/SearchHistoryControllerV2.java index 1ca022b..e645f7e 100644 --- a/src/main/java/com/solucitation/midpoint_backend/domain/history2/api/SearchHistoryControllerV2.java +++ b/src/main/java/com/solucitation/midpoint_backend/domain/history2/api/SearchHistoryControllerV2.java @@ -107,10 +107,6 @@ public ResponseEntity getHistory(Authentication authentication) { String memberEmail = authentication.getName(); Member member = memberService.getMemberByEmail(memberEmail); - if (member == null) { - return ResponseEntity.status(HttpStatus.NOT_FOUND) - .body(Map.of("error", "USER_NOT_FOUND", "message", "사용자를 찾을 수 없습니다.")); - } List searchHistoryResponseDtos = searchHistoryService.getHistory(member); return ResponseEntity.ok(searchHistoryResponseDtos); @@ -120,4 +116,30 @@ public ResponseEntity getHistory(Authentication authentication) { } } +// /** +// * 검색 기록을 일괄 삭제합니다. (내부용) +// * @param authentication 인증 정보 +// * @return +// * 삭제 성공 시 204 NO_CONTENT를 반환합니다. +// * 로그인하지 않은 계정일 경우 401 UNAUTHORIZED 를 반환합니다. +// * 기타 오류 발생 시 500 INTERNAL_SERVER_ERROR 를 반환합니다. +// */ +// @DeleteMapping("/all") +// public ResponseEntity removeAll(Authentication authentication) { +// try { +// if (authentication == null || !authentication.isAuthenticated()) { +// return ResponseEntity.status(HttpStatus.UNAUTHORIZED) +// .body(Map.of("error", "UNAUTHORIZED", "message", "해당 서비스를 이용하기 위해서는 로그인이 필요합니다.")); +// } +// +// String memberEmail = authentication.getName(); +// Member member = memberService.getMemberByEmail(memberEmail); +// +// searchHistoryService.removeAll(member); +// return ResponseEntity.status(HttpStatus.NO_CONTENT).body(Map.of("message", "감색 기록을 일괄 삭제하였습니다.")); +// } catch (Exception e) { +// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) +// .body(Map.of("error", e.getMessage(), "message", "검색 기록 삭제 중 오류가 발생하였습니다.")); +// } +// } } \ No newline at end of file