From 01401aa9aa24f460dd31a9634e797b80a72d6edf Mon Sep 17 00:00:00 2001 From: Yujin1219 Date: Thu, 11 Sep 2025 14:48:54 +0900 Subject: [PATCH 1/3] =?UTF-8?q?Refactor:=20=EA=B4=80=EB=A6=AC=EC=9E=90?= =?UTF-8?q?=EC=9A=A9=20api=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AdminReportController.java | 46 +++++++++++++++++++ .../report/controller/ReportController.java | 24 ---------- 2 files changed, 46 insertions(+), 24 deletions(-) create mode 100644 src/main/java/com/DecodEat/domain/report/controller/AdminReportController.java diff --git a/src/main/java/com/DecodEat/domain/report/controller/AdminReportController.java b/src/main/java/com/DecodEat/domain/report/controller/AdminReportController.java new file mode 100644 index 0000000..2e0eb49 --- /dev/null +++ b/src/main/java/com/DecodEat/domain/report/controller/AdminReportController.java @@ -0,0 +1,46 @@ +package com.DecodEat.domain.report.controller; + +import com.DecodEat.domain.report.dto.response.ReportResponseDto; +import com.DecodEat.domain.report.service.ReportService; +import com.DecodEat.global.apiPayload.ApiResponse; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/admin/reports") +@Tag(name = "[관리자] 신고 관리") +public class AdminReportController { + + private final ReportService reportService; + + @Operation( + summary = "상품 수정 요청 조회 (관리자)", + description = "관리자가 모든 상품 정보 수정 요청을 페이지별로 조회합니다. 영양 정보 수정과 이미지 확인 요청을 모두 포함합니다.") + @Parameters({ + // @PreAuthorize("hasRole('ADMIN')") // Spring Security 사용 시 권한 설정 + @Parameter(name = "page", description = "페이지 번호, 0부터 시작합니다.", example = "0"), + @Parameter(name = "size", description = "한 페이지에 보여줄 항목 수", example = "10") + }) + @GetMapping + public ApiResponse getReports( + @RequestParam(defaultValue = "0") int page, + @RequestParam(defaultValue = "10") int size + ) { + return ApiResponse.onSuccess(reportService.getReports(page, size)); + } + + @Operation( + summary = "상품 수정 요청 거절 (관리자)", + description = "관리자가 상품 정보 수정 요청을 거절합니다. 해당 신고 내역의 상태를 REJECTED로 변경합니다.") + @Parameter(name = "reportId", description = "거절할 신고의 ID", example = "1") + // @PreAuthorize("hasRole('ADMIN')") // Spring Security 사용 시 권한 설정 + @PatchMapping("/{reportId}/reject") + public ApiResponse rejectReport(@PathVariable Long reportId) { + return ApiResponse.onSuccess(reportService.rejectReport(reportId)); + } +} diff --git a/src/main/java/com/DecodEat/domain/report/controller/ReportController.java b/src/main/java/com/DecodEat/domain/report/controller/ReportController.java index 9c53738..074292d 100644 --- a/src/main/java/com/DecodEat/domain/report/controller/ReportController.java +++ b/src/main/java/com/DecodEat/domain/report/controller/ReportController.java @@ -45,29 +45,5 @@ public ApiResponse requestCheckImage(@CurrentUser User user, return ApiResponse.onSuccess(reportService.requestCheckImage(user, productId, imageUrl)); } - @Operation( - summary = "상품 수정 요청 조회 (관리자)", - description = "관리자가 모든 상품 정보 수정 요청을 페이지별로 조회합니다. 영양 정보 수정과 이미지 확인 요청을 모두 포함합니다.") - @Parameters({ - // @PreAuthorize("hasRole('ADMIN')") // Spring Security 사용 시 권한 설정 - @Parameter(name = "page", description = "페이지 번호, 0부터 시작합니다.", example = "0"), - @Parameter(name = "size", description = "한 페이지에 보여줄 항목 수", example = "10") - }) - @GetMapping - public ApiResponse getReports( - @RequestParam(defaultValue = "0") int page, - @RequestParam(defaultValue = "10") int size - ) { - return ApiResponse.onSuccess(reportService.getReports(page, size)); - } - @Operation( - summary = "상품 수정 요청 거절 (관리자)", - description = "관리자가 상품 정보 수정 요청을 거절합니다. 해당 신고 내역의 상태를 REJECTED로 변경합니다.") - @Parameter(name = "reportId", description = "거절할 신고의 ID", example = "1") - // @PreAuthorize("hasRole('ADMIN')") // Spring Security 사용 시 권한 설정 - @PatchMapping("/{reportId}/reject") - public ApiResponse rejectReport(@PathVariable Long reportId) { - return ApiResponse.onSuccess(reportService.rejectReport(reportId)); - } } From de9f9a54b97fb3c1cba6abdc80528d730702611d Mon Sep 17 00:00:00 2001 From: Yujin1219 Date: Thu, 11 Sep 2025 15:13:46 +0900 Subject: [PATCH 2/3] =?UTF-8?q?Chore:=20=EB=A3=A8=ED=8A=B8=20=EB=8F=84?= =?UTF-8?q?=EB=A9=94=EC=9D=B8=20cors=20=EC=84=A4=EC=A0=95=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/DecodEat/global/config/CorsConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/DecodEat/global/config/CorsConfig.java b/src/main/java/com/DecodEat/global/config/CorsConfig.java index 7c369dd..bbecc43 100644 --- a/src/main/java/com/DecodEat/global/config/CorsConfig.java +++ b/src/main/java/com/DecodEat/global/config/CorsConfig.java @@ -16,7 +16,7 @@ public CorsConfigurationSource corsConfigurationSource() { CorsConfiguration configuration = new CorsConfiguration(); configuration.setAllowedOriginPatterns(List.of( "https://decodeat.netlify.app", - "http://localhost:8080","http://localhost:5173", "http://decodeat.store", "https://decodeat.store" )); + "http://localhost:8080","http://localhost:5173", "http://decodeat.store", "https://decodeat.store", "http://www.decodeat.store", "https://www.decodeat.store" )); configuration.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "OPTIONS")); configuration.setAllowedHeaders(List.of("*")); configuration.setAllowCredentials(true); // 쿠키/인증정보 포함 허용 From d66e0a836fe53d9d6de5996730c325749b684e7f Mon Sep 17 00:00:00 2001 From: Yujin1219 Date: Thu, 11 Sep 2025 15:42:45 +0900 Subject: [PATCH 3/3] =?UTF-8?q?Fix:=20=EC=B9=B4=EC=B9=B4=EC=98=A4=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=95=84=EC=9B=83=20=EB=A6=AC=EB=8B=A4?= =?UTF-8?q?=EC=9D=B4=EB=A0=89=ED=8A=B8=20url=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/DecodEat/global/config/WebOAuthSecurityConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/DecodEat/global/config/WebOAuthSecurityConfig.java b/src/main/java/com/DecodEat/global/config/WebOAuthSecurityConfig.java index b1f22ea..5f804e5 100644 --- a/src/main/java/com/DecodEat/global/config/WebOAuthSecurityConfig.java +++ b/src/main/java/com/DecodEat/global/config/WebOAuthSecurityConfig.java @@ -81,7 +81,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti http.logout(logout -> logout .logoutUrl("/api/logout") // 👇 카카오 로그아웃 URL로 리다이렉트 - .logoutSuccessUrl("https://kauth.kakao.com/oauth/logout?client_id=" + kakaoClientId + "&logout_redirect_uri=https://decodeat.store.app/") + .logoutSuccessUrl("https://kauth.kakao.com/oauth/logout?client_id=" + kakaoClientId + "&logout_redirect_uri=https://decodeat.store/") .invalidateHttpSession(true) .deleteCookies("JSESSIONID") .clearAuthentication(true)