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
Expand Up @@ -49,6 +49,7 @@ public ApiResponse<ReportResponseDto> requestCheckImage(@CurrentUser User user,
summary = "상품 수정 요청 조회 (관리자)",
description = "관리자가 모든 상품 정보 수정 요청을 페이지별로 조회합니다. 영양 정보 수정과 이미지 확인 요청을 모두 포함합니다.")
@Parameters({
// @PreAuthorize("hasRole('ADMIN')") // Spring Security 사용 시 권한 설정
@Parameter(name = "page", description = "페이지 번호, 0부터 시작합니다.", example = "0"),
@Parameter(name = "size", description = "한 페이지에 보여줄 항목 수", example = "10")
})
Expand All @@ -59,4 +60,14 @@ public ApiResponse<ReportResponseDto.ReportListResponseDTO> getReports(
) {
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 @@ -9,6 +9,7 @@

@Entity
@Getter
@Setter
@SuperBuilder // 자식 클래스에서 부모 클래스 필드까지 빌드(컴파일 시점에) <-> @Builder
@AllArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED) // 서비스 코드 등 다른 곳에서 의미 없는 빈 객체를 실수로 생성하는 것 예방
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.DecodEat.domain.report.entity;

public enum ReportStatus {
IN_PROGRESS,
UPDATED,
CHECKED
IN_PROGRESS, // 대기
ACCEPTED, // 수락
REJECTED // 거절
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import com.DecodEat.domain.report.dto.request.ProductNutritionUpdateRequestDto;
import com.DecodEat.domain.report.dto.response.ReportResponseDto;
import com.DecodEat.domain.report.entity.ReportRecord;
import com.DecodEat.domain.report.entity.ReportStatus;
import com.DecodEat.domain.report.entity.ReportRecord;
import com.DecodEat.domain.report.repository.ImageReportRepository;
import com.DecodEat.domain.report.repository.NutritionReportRepository;
import com.DecodEat.domain.report.repository.ReportRecordRepository;
Expand Down Expand Up @@ -55,4 +57,20 @@ public ReportResponseDto.ReportListResponseDTO getReports(int page, int size) {
return ReportConverter.toReportListResponseDTO(reportPage);
}

/**
* 상품 수정 신고 요청 거절
* @param reportId 거절할 신고의 ID
* @return 처리 결과를 담은 DTO
*/
public ReportResponseDto rejectReport(Long reportId){
// 1. ID로 신고 내역 조회
ReportRecord reportRecord = reportRecordRepository.findById(reportId)
.orElseThrow(() -> new GeneralException(REPORT_NOT_FOUND));

// 2. reportstatus 상태를 rejected로 변경
reportRecord.setReportStatus(ReportStatus.REJECTED);

// 3. DTO 반환
return ReportConverter.toReportResponseDto(reportRecord.getProduct().getProductId(), "신고 요청이 거절 처리되었습니다.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ public enum ErrorStatus implements BaseErrorCode {
DUPLICATE_UNIQUE_KEY(HttpStatus.CONFLICT, "COMMON_005", "이미 처리된 요청입니다."),

// s3 사진 첨부 에러
FILE_UPLOAD_FAILED(HttpStatus.INTERNAL_SERVER_ERROR, "FILE_001", "파일 업로드에 실패했습니다.");
FILE_UPLOAD_FAILED(HttpStatus.INTERNAL_SERVER_ERROR, "FILE_001", "파일 업로드에 실패했습니다."),

// 신고
REPORT_NOT_FOUND(HttpStatus.NOT_FOUND, "REPONT_401", "존재하지 않는 신고 내역 입니다.");

private final HttpStatus httpStatus;
private final String code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ private void clearAuthenticationAttributes(HttpServletRequest request, HttpServl

// 액세스 토큰을 리다이렉트 경로에 파라미터로 추가
private String getTargetUrl(String token) {
return UriComponentsBuilder.fromUriString("https://decodeat.netlify.app") //todo:로그인 후 스웨거화면
return UriComponentsBuilder.fromUriString("/decodeat.store") //todo:로그인 후 스웨거화면
.queryParam("token", token)
.build()
.toUriString();
}
Expand Down
Loading