diff --git a/backend/src/main/java/com/edufocus/edufocus/report/repository/ReportRepository.java b/backend/src/main/java/com/edufocus/edufocus/report/repository/ReportRepository.java index 7665f28..7b1e1ac 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/repository/ReportRepository.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/repository/ReportRepository.java @@ -9,13 +9,10 @@ import java.util.UUID; @Repository public interface ReportRepository extends JpaRepository { - List findByUserId(long userId); - - List findByLectureId(long lectureId); Report findByReportSetIdAndUserId(UUID reportSetId, long userId); - List findByReportSetId(UUID reportSetId); + List findByReportSetIdDesc(UUID reportSetId); - List findByLectureIdAndUserId(long lectureId, long userId); + List findByLectureIdAndUserIdDesc(long lectureId, long userId); } diff --git a/backend/src/main/java/com/edufocus/edufocus/report/repository/ReportSetRepository.java b/backend/src/main/java/com/edufocus/edufocus/report/repository/ReportSetRepository.java index f1b484c..f4f37fb 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/repository/ReportSetRepository.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/repository/ReportSetRepository.java @@ -9,5 +9,5 @@ import java.util.UUID; @Repository public interface ReportSetRepository extends JpaRepository { - List findByLectureId(long userId); + List findByLectureIdDesc(long userId); } diff --git a/backend/src/main/java/com/edufocus/edufocus/report/service/ReportServiceImpl.java b/backend/src/main/java/com/edufocus/edufocus/report/service/ReportServiceImpl.java index 33d0a71..1b80593 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/service/ReportServiceImpl.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/service/ReportServiceImpl.java @@ -125,7 +125,7 @@ public class ReportServiceImpl implements ReportService { @Override public List findReportSets(long lectureId) { - List reportSets = reportSetRepository.findByLectureId(lectureId); + List reportSets = reportSetRepository.findByLectureIdDesc(lectureId); return reportSets.stream() .map(ReportSet::makeReportSetResponse) @@ -134,7 +134,7 @@ public class ReportServiceImpl implements ReportService { @Override public List findReports(UUID reportSetId) { - List reports = reportRepository.findByReportSetId(reportSetId); + List reports = reportRepository.findByReportSetIdDesc(reportSetId); return reports.stream() .map(Report::makeReportResponse) @@ -143,7 +143,7 @@ public class ReportServiceImpl implements ReportService { @Override public List findReports(long lectureId, long userId) { - List reports = reportRepository.findByLectureIdAndUserId(lectureId, userId); + List reports = reportRepository.findByLectureIdAndUserIdDesc(lectureId, userId); return reports.stream() .map(Report::makeReportResponse)