diff --git a/src/main/java/com/team/cklob/gami/domain/admin/dto/response/AdminReportResponse.java b/src/main/java/com/team/cklob/gami/domain/admin/dto/response/AdminReportResponse.java index 9a38e81e..ca7f0f20 100644 --- a/src/main/java/com/team/cklob/gami/domain/admin/dto/response/AdminReportResponse.java +++ b/src/main/java/com/team/cklob/gami/domain/admin/dto/response/AdminReportResponse.java @@ -1,6 +1,7 @@ package com.team.cklob.gami.domain.admin.dto.response; import com.team.cklob.gami.domain.report.entity.Report; +import com.team.cklob.gami.domain.report.entity.constant.ReportResult; import com.team.cklob.gami.domain.report.entity.constant.ReportType; import lombok.Builder; import lombok.Getter; @@ -11,11 +12,17 @@ public class AdminReportResponse { private final Long id; private final ReportType reportType; + private final ReportResult reportResult; + private final String reporterName; + private final Long reportedPostId; public static AdminReportResponse from(Report report) { return AdminReportResponse.builder() .id(report.getId()) .reportType(report.getReportType()) + .reportResult(report.getResult()) + .reporterName(report.getReporter().getName()) + .reportedPostId(report.getPost().getId()) .build(); } } diff --git a/src/main/java/com/team/cklob/gami/domain/admin/service/impl/AdminReportListServiceImpl.java b/src/main/java/com/team/cklob/gami/domain/admin/service/impl/AdminReportListServiceImpl.java index a70e47d4..236b7be9 100644 --- a/src/main/java/com/team/cklob/gami/domain/admin/service/impl/AdminReportListServiceImpl.java +++ b/src/main/java/com/team/cklob/gami/domain/admin/service/impl/AdminReportListServiceImpl.java @@ -18,7 +18,7 @@ public class AdminReportListServiceImpl implements AdminReportListService { @Override public List getReports() { - return reportRepository.findAll() + return reportRepository.findAllWithReporterAndPost() .stream() .map(AdminReportResponse::from) .toList(); diff --git a/src/main/java/com/team/cklob/gami/domain/report/repository/ReportRepository.java b/src/main/java/com/team/cklob/gami/domain/report/repository/ReportRepository.java index 040b584f..d1313f85 100644 --- a/src/main/java/com/team/cklob/gami/domain/report/repository/ReportRepository.java +++ b/src/main/java/com/team/cklob/gami/domain/report/repository/ReportRepository.java @@ -3,6 +3,9 @@ import com.team.cklob.gami.domain.report.entity.Report; import com.team.cklob.gami.domain.report.entity.constant.ReportType; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; public interface ReportRepository extends JpaRepository { @@ -11,4 +14,12 @@ boolean existsByReporterIdAndPostIdAndReportType( Long postId, ReportType reportType ); + + @Query(""" + SELECT r + FROM Report r + JOIN FETCH r.reporter + JOIN FETCH r.post + """) + List findAllWithReporterAndPost(); }