Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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<ReportResponseDto.ReportListResponseDTO> 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<ReportResponseDto> rejectReport(@PathVariable Long reportId) {
return ApiResponse.onSuccess(reportService.rejectReport(reportId));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,29 +45,5 @@ public ApiResponse<ReportResponseDto> 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<ReportResponseDto.ReportListResponseDTO> 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<ReportResponseDto> rejectReport(@PathVariable Long reportId) {
return ApiResponse.onSuccess(reportService.rejectReport(reportId));
}
}
2 changes: 1 addition & 1 deletion src/main/java/com/DecodEat/global/config/CorsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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); // 쿠키/인증정보 포함 허용
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading