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)); - } } 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); // 쿠키/인증정보 포함 허용 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)