Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.
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
@@ -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;
Expand All @@ -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())
Comment thread
exijn marked this conversation as resolved.
Resolved
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class AdminReportListServiceImpl implements AdminReportListService {

@Override
public List<AdminReportResponse> getReports() {
return reportRepository.findAll()
return reportRepository.findAllWithReporterAndPost()
.stream()
.map(AdminReportResponse::from)
.toList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Report, Long> {

Expand All @@ -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<Report> findAllWithReporterAndPost();
}