From 776a37c5abaddb8e5da2c657a5c4639504d7b6b8 Mon Sep 17 00:00:00 2001 From: hej090224 Date: Sat, 27 Dec 2025 21:56:03 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=EC=96=B4=EB=93=9C=EB=AF=BC=20?= =?UTF-8?q?=EC=8B=A0=EA=B3=A0=20=EB=AA=A9=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EC=9D=91=EB=8B=B5=20=ED=95=84=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/admin/dto/response/AdminReportResponse.java | 7 +++++++ 1 file changed, 7 insertions(+) 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(); } } From 0418ef36a23e6110a9ffab016d7746cd50004211 Mon Sep 17 00:00:00 2001 From: hej090224 Date: Sat, 27 Dec 2025 23:22:41 +0900 Subject: [PATCH 2/2] =?UTF-8?q?refactor:=20=EC=8B=A0=EA=B3=A0=20=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20N+1=20=EB=AC=B8=EC=A0=9C=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0=EC=9D=84=20=EC=9C=84=ED=95=B4=20fetch=20join?= =?UTF-8?q?=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/AdminReportListServiceImpl.java | 2 +- .../domain/report/repository/ReportRepository.java | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) 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(); }