From d746a0006ff4b6445ce45fad53bb90553cbcbb92 Mon Sep 17 00:00:00 2001 From: yulmam <70622601+yulmam@users.noreply.github.com> Date: Thu, 8 Aug 2024 21:49:11 +0900 Subject: [PATCH 01/10] =?UTF-8?q?refactor=20:=20report=20=EC=98=A4?= =?UTF-8?q?=ED=83=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../edufocus/edufocus/report/entity/dto/QuizDto.java | 2 +- .../edufocus/report/service/ReportServiceImpl.java | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/com/edufocus/edufocus/report/entity/dto/QuizDto.java b/backend/src/main/java/com/edufocus/edufocus/report/entity/dto/QuizDto.java index d36281f..5dbc56e 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/entity/dto/QuizDto.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/entity/dto/QuizDto.java @@ -18,6 +18,6 @@ public class QuizDto { private String image; private String answer; private String userAnswer; - private boolean isCollect; + private boolean isCorrect; private List choices; } 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 3ae6792..b4e637b 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 @@ -54,17 +54,17 @@ public class ReportServiceImpl implements ReportService { for (int idx = 0; idx < answerInputList.size(); idx++) { Quiz quiz = quizList.get(idx); String inputAnswer = answerInputList.get(idx); - boolean isCollect; + boolean isCorrect; Answer answer; if (quiz.getAnswer().equals(inputAnswer)) { correctCount++; - isCollect = true; + isCorrect = true; } else { - isCollect = false; + isCorrect = false; } answer = Answer.builder() .userAnswer(inputAnswer) - .isCorrect(isCollect) + .isCorrect(isCorrect) .report(report) .quiz(quiz) .build(); @@ -106,7 +106,7 @@ public class ReportServiceImpl implements ReportService { .question(quiz.getQuestion()) .answer(quiz.getAnswer()) .userAnswer(answer.getUserAnswer()) - .isCollect(answer.isCorrect()) + .isCorrect(answer.isCorrect()) .choices(choiceDtos) .build(); From 6ba555de6275ba5e185dae9b023ac929141b3aab Mon Sep 17 00:00:00 2001 From: yulmam <70622601+yulmam@users.noreply.github.com> Date: Thu, 8 Aug 2024 21:52:53 +0900 Subject: [PATCH 02/10] =?UTF-8?q?refactor=20:=20registartion=20=EC=98=A4?= =?UTF-8?q?=ED=83=80=20=EC=A0=95=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../registration/controller/RegistrationController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/com/edufocus/edufocus/registration/controller/RegistrationController.java b/backend/src/main/java/com/edufocus/edufocus/registration/controller/RegistrationController.java index 4b8bba3..2b019c9 100644 --- a/backend/src/main/java/com/edufocus/edufocus/registration/controller/RegistrationController.java +++ b/backend/src/main/java/com/edufocus/edufocus/registration/controller/RegistrationController.java @@ -36,7 +36,7 @@ public class RegistrationController { } @PutMapping("/{registrationId}") - public ResponseEntity acceptRigistration(@RequestHeader("Authorization") String accessToken, @PathVariable long registrationId) { + public ResponseEntity acceptRegistration(@RequestHeader("Authorization") String accessToken, @PathVariable long registrationId) { Long userId = Long.parseLong(jwtUtil.getUserId(accessToken)); if (!registrationService.acceptRegistration(userId, registrationId)) { @@ -47,7 +47,7 @@ public class RegistrationController { } @DeleteMapping("/{registrationId}") - public ResponseEntity deleteRigistration(@RequestHeader("Authorization") String accessToken, @PathVariable long registrationId) { + public ResponseEntity deleteRegistration(@RequestHeader("Authorization") String accessToken, @PathVariable long registrationId) { Long userId = Long.parseLong(jwtUtil.getUserId(accessToken)); if (!registrationService.deleteRegistration(userId, registrationId)) { From 1962d5b2dfaabe95bc05535f2edaa2c8c44a16ee Mon Sep 17 00:00:00 2001 From: yulmam <70622601+yulmam@users.noreply.github.com> Date: Thu, 8 Aug 2024 21:55:54 +0900 Subject: [PATCH 03/10] =?UTF-8?q?feat=20:=20report,=20reportSet=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=EC=8B=9C=20=EC=8B=9C=EA=B0=84=20=EA=B0=B1?= =?UTF-8?q?=EC=8B=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/edufocus/edufocus/report/entity/vo/Report.java | 4 ++++ .../com/edufocus/edufocus/report/entity/vo/ReportSet.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Report.java b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Report.java index dcc4b95..c588112 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Report.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Report.java @@ -3,9 +3,11 @@ package com.edufocus.edufocus.report.entity.vo; import com.edufocus.edufocus.quiz.entity.QuizSet; import com.edufocus.edufocus.report.entity.dto.ReportResponse; import com.edufocus.edufocus.user.model.entity.vo.User; +import com.fasterxml.jackson.annotation.JsonAutoDetect; import jakarta.persistence.*; import lombok.*; import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; import java.time.LocalDateTime; import java.util.Date; @@ -17,6 +19,8 @@ import java.util.List; @NoArgsConstructor @AllArgsConstructor @Builder +@EntityListeners(AuditingEntityListener.class) +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) public class Report { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) diff --git a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java index 2dedc12..e097f97 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java @@ -3,11 +3,13 @@ package com.edufocus.edufocus.report.entity.vo; import com.edufocus.edufocus.lecture.entity.Lecture; import com.edufocus.edufocus.quiz.entity.QuizSet; import com.edufocus.edufocus.report.entity.dto.ReportSetResponse; +import com.fasterxml.jackson.annotation.JsonAutoDetect; import jakarta.persistence.*; import lombok.*; import org.hibernate.annotations.ColumnDefault; import org.hibernate.annotations.GenericGenerator; import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; import java.time.LocalDateTime; @@ -21,6 +23,8 @@ import java.util.UUID; @Builder @NoArgsConstructor @AllArgsConstructor +@EntityListeners(AuditingEntityListener.class) +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) public class ReportSet { @Id @GeneratedValue(generator = "UUID") From 0f60c9c4cf0cf56b2e396475706fe1f3c126deed Mon Sep 17 00:00:00 2001 From: yulmam <70622601+yulmam@users.noreply.github.com> Date: Thu, 8 Aug 2024 21:57:39 +0900 Subject: [PATCH 04/10] =?UTF-8?q?feat=20:=20=EA=B2=8C=EC=8B=9C=ED=8C=90=20?= =?UTF-8?q?=EB=8C=93=EA=B8=80=20=ED=98=95=20text=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/edufocus/edufocus/board/entity/vo/Board.java | 2 +- .../java/com/edufocus/edufocus/board/entity/vo/Comment.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Board.java b/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Board.java index c2a2519..e4fba11 100644 --- a/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Board.java +++ b/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Board.java @@ -34,7 +34,7 @@ public class Board { @Column(nullable = false) private String category; - @Column(nullable = false) + @Column(columnDefinition = "TEXT", nullable = false) private String content; @Column(nullable = true) diff --git a/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Comment.java b/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Comment.java index aa05c5b..9bd6361 100644 --- a/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Comment.java +++ b/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Comment.java @@ -22,7 +22,8 @@ public class Comment { @Id @GeneratedValue private long id; - @Column + + @Column(columnDefinition = "TEXT", nullable = false) private String content; @Column From 5dfbcb3dd204c5ac71bd97420271e631a9c00ef8 Mon Sep 17 00:00:00 2001 From: yulmam <70622601+yulmam@users.noreply.github.com> Date: Thu, 8 Aug 2024 22:04:47 +0900 Subject: [PATCH 05/10] =?UTF-8?q?feat=20:=20reportSet=20delete=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../edufocus/report/controller/ReportController.java | 9 +++++++++ .../edufocus/edufocus/report/entity/vo/ReportSet.java | 4 ++++ .../edufocus/edufocus/report/service/ReportService.java | 2 ++ .../edufocus/report/service/ReportServiceImpl.java | 7 +++++++ 4 files changed, 22 insertions(+) diff --git a/backend/src/main/java/com/edufocus/edufocus/report/controller/ReportController.java b/backend/src/main/java/com/edufocus/edufocus/report/controller/ReportController.java index 673bf19..3dfda46 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/controller/ReportController.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/controller/ReportController.java @@ -87,4 +87,13 @@ public class ReportController { return new ResponseEntity<>(reportResponses, HttpStatus.OK); } + @DeleteMapping("/teacher/report/{reportSetId}") + public ResponseEntity deleteReportSet(@PathVariable("reportSetId") UUID reportSetId, HttpServletRequest request){ + String token = request.getHeader("Authorization"); + long userId = Long.parseLong(jwtUtil.getUserId(token)); + + reportService.deleteReportSet(reportSetId, userId); + + return new ResponseEntity<>(HttpStatus.OK); + } } diff --git a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java index e097f97..5ff6b88 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java @@ -55,4 +55,8 @@ public class ReportSet { .testAt(createAt) .build(); } + + public long findUserId(){ + return lecture.getUser().getId(); + } } diff --git a/backend/src/main/java/com/edufocus/edufocus/report/service/ReportService.java b/backend/src/main/java/com/edufocus/edufocus/report/service/ReportService.java index 1e1b2b2..5c51ab5 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/service/ReportService.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/service/ReportService.java @@ -20,4 +20,6 @@ public interface ReportService { List findReports(long lectureId, long userid); UUID initReportSet(long lectureId, long quizSetId); + + void deleteReportSet(UUID reportSetId, 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 b4e637b..33d0a71 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 @@ -172,4 +172,11 @@ public class ReportServiceImpl implements ReportService { return reportSet.getId(); } + + @Override + public void deleteReportSet(UUID reportSetId, long userId) { + ReportSet reportSet = reportSetRepository.findById(reportSetId).orElseThrow(NoSuchElementException::new); + if(reportSet.findUserId() == userId) + reportSetRepository.delete(reportSet); + } } From 5740b6f53a711e6893ba559b47c546b0168e18da Mon Sep 17 00:00:00 2001 From: kgc91747 Date: Fri, 9 Aug 2024 09:47:04 +0900 Subject: [PATCH 06/10] =?UTF-8?q?feat:=20Lecture=20=EA=B0=95=EC=9D=98=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=EC=BB=AC=EB=9F=BC=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/edufocus/edufocus/lecture/entity/Lecture.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/com/edufocus/edufocus/lecture/entity/Lecture.java b/backend/src/main/java/com/edufocus/edufocus/lecture/entity/Lecture.java index 5db4488..734354a 100644 --- a/backend/src/main/java/com/edufocus/edufocus/lecture/entity/Lecture.java +++ b/backend/src/main/java/com/edufocus/edufocus/lecture/entity/Lecture.java @@ -27,10 +27,10 @@ public class Lecture { @Column private String title; - @Lob + @Column(columnDefinition = "text") private String description; - @Lob + @Column(columnDefinition = "text") private String plan; @Column From 49bf79dd05a9bfee133a78a18dcfa5e20fa21e4a Mon Sep 17 00:00:00 2001 From: yulmam <70622601+yulmam@users.noreply.github.com> Date: Fri, 9 Aug 2024 10:10:24 +0900 Subject: [PATCH 07/10] =?UTF-8?q?feat=20:=20=EC=8B=9C=EA=B0=84=EB=8C=80=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/edufocus/edufocus/board/entity/vo/Board.java | 2 ++ .../com/edufocus/edufocus/board/entity/vo/Comment.java | 8 ++++++-- .../edufocus/report/controller/ReportController.java | 3 --- .../com/edufocus/edufocus/report/entity/vo/Report.java | 1 + .../com/edufocus/edufocus/report/entity/vo/ReportSet.java | 1 + 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Board.java b/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Board.java index e4fba11..0f7d34a 100644 --- a/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Board.java +++ b/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Board.java @@ -40,9 +40,11 @@ public class Board { @Column(nullable = true) private int viewCount; + @Column(columnDefinition = "TIMESTAMP") @CreatedDate LocalDateTime createdAt; + @Column(columnDefinition = "TIMESTAMP") @LastModifiedDate LocalDateTime modifiedAt; diff --git a/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Comment.java b/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Comment.java index 9bd6361..9887128 100644 --- a/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Comment.java +++ b/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Comment.java @@ -9,6 +9,8 @@ import lombok.AllArgsConstructor; import lombok.Builder; import lombok.NoArgsConstructor; import lombok.Setter; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.LastModifiedDate; import java.time.LocalDateTime; @@ -26,10 +28,12 @@ public class Comment { @Column(columnDefinition = "TEXT", nullable = false) private String content; - @Column + @Column(columnDefinition = "TIMESTAMP") + @CreatedDate private LocalDateTime createdAt; - @Column + @Column(columnDefinition = "TIMESTAMP") + @LastModifiedDate private LocalDateTime modifiedAt; @ManyToOne diff --git a/backend/src/main/java/com/edufocus/edufocus/report/controller/ReportController.java b/backend/src/main/java/com/edufocus/edufocus/report/controller/ReportController.java index 3dfda46..ec1c747 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/controller/ReportController.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/controller/ReportController.java @@ -64,9 +64,6 @@ public class ReportController { return new ResponseEntity<>(detailReport, HttpStatus.OK); } - - - @GetMapping("/teacher/reportSet/{lectureId}") public ResponseEntity> searchReportSets(@PathVariable("lectureId") long lectureId){ List reportSetResponses = reportService.findReportSets(lectureId); diff --git a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Report.java b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Report.java index c588112..9205532 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Report.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Report.java @@ -30,6 +30,7 @@ public class Report { private int correctCount; + @Column(columnDefinition = "TIMESTAMP") @CreatedDate private LocalDateTime testAt; diff --git a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java index 5ff6b88..7f8f691 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java @@ -34,6 +34,7 @@ public class ReportSet { ) private UUID id; + @Column(columnDefinition = "TIMESTAMP") @CreatedDate private LocalDateTime createAt; From 696fb85a21d45f5247aa5a6760402cc5eafa6e11 Mon Sep 17 00:00:00 2001 From: yulmam <70622601+yulmam@users.noreply.github.com> Date: Fri, 9 Aug 2024 10:10:46 +0900 Subject: [PATCH 08/10] =?UTF-8?q?feat=20:=20getter=20setter=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../edufocus/report/entity/dto/ReportSetResponse.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/com/edufocus/edufocus/report/entity/dto/ReportSetResponse.java b/backend/src/main/java/com/edufocus/edufocus/report/entity/dto/ReportSetResponse.java index ad300bf..a7ea791 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/entity/dto/ReportSetResponse.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/entity/dto/ReportSetResponse.java @@ -1,14 +1,14 @@ package com.edufocus.edufocus.report.entity.dto; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.NoArgsConstructor; +import lombok.*; import java.time.LocalDateTime; import java.util.UUID; @Builder +@Getter +@Setter @NoArgsConstructor @AllArgsConstructor public class ReportSetResponse { From 3ccd5e99b0cb461d98b8c1b0741077235012ffb0 Mon Sep 17 00:00:00 2001 From: yulmam <70622601+yulmam@users.noreply.github.com> Date: Fri, 9 Aug 2024 10:12:57 +0900 Subject: [PATCH 09/10] =?UTF-8?q?feat=20:=20report=20=EC=A0=95=EB=A0=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../edufocus/report/repository/ReportRepository.java | 7 ++----- .../edufocus/report/repository/ReportSetRepository.java | 2 +- .../edufocus/report/service/ReportServiceImpl.java | 6 +++--- 3 files changed, 6 insertions(+), 9 deletions(-) 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) From aeb2d7f93233e293f8894db95d78f0716777e7b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=95=9C=EC=96=BC?= Date: Fri, 9 Aug 2024 10:17:36 +0900 Subject: [PATCH 10/10] Revert "Merge branch 'Be/Report' into 'backend'" This reverts merge request !126 --- .../edufocus/report/repository/ReportRepository.java | 7 +++++-- .../edufocus/report/repository/ReportSetRepository.java | 2 +- .../edufocus/report/service/ReportServiceImpl.java | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) 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 7b1e1ac..7665f28 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,10 +9,13 @@ 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 findByReportSetIdDesc(UUID reportSetId); + List findByReportSetId(UUID reportSetId); - List findByLectureIdAndUserIdDesc(long lectureId, long userId); + List findByLectureIdAndUserId(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 f4f37fb..f1b484c 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 findByLectureIdDesc(long userId); + List findByLectureId(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 1b80593..33d0a71 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.findByLectureIdDesc(lectureId); + List reportSets = reportSetRepository.findByLectureId(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.findByReportSetIdDesc(reportSetId); + List reports = reportRepository.findByReportSetId(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.findByLectureIdAndUserIdDesc(lectureId, userId); + List reports = reportRepository.findByLectureIdAndUserId(lectureId, userId); return reports.stream() .map(Report::makeReportResponse)