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 20f82e1..f07149f 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 @@ -1,7 +1,8 @@ package com.edufocus.edufocus.report.controller; -import com.edufocus.edufocus.report.entity.Report; -import com.edufocus.edufocus.report.entity.ReportRequset; +import com.edufocus.edufocus.report.entity.dto.ReportResponse; +import com.edufocus.edufocus.report.entity.vo.Report; +import com.edufocus.edufocus.report.entity.dto.ReportRequset; import com.edufocus.edufocus.report.service.ReportService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -27,8 +28,8 @@ public class ReportController{ @PostMapping("/submit") - public ResponseEntity submit(@RequestBody ReportRequset reportRequset) throws SQLException { - Report report = reportService.grading(reportRequset); + public ResponseEntity submit(@RequestBody ReportRequset reportRequset) throws SQLException { + ReportResponse report = reportService.grading(reportRequset); return new ResponseEntity<>(report,HttpStatus.CREATED); } diff --git a/backend/src/main/java/com/edufocus/edufocus/report/entity/AnswerInput.java b/backend/src/main/java/com/edufocus/edufocus/report/entity/dto/AnswerInput.java similarity index 68% rename from backend/src/main/java/com/edufocus/edufocus/report/entity/AnswerInput.java rename to backend/src/main/java/com/edufocus/edufocus/report/entity/dto/AnswerInput.java index c237616..ba1ff2e 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/entity/AnswerInput.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/entity/dto/AnswerInput.java @@ -1,4 +1,4 @@ -package com.edufocus.edufocus.report.entity; +package com.edufocus.edufocus.report.entity.dto; import lombok.Getter; diff --git a/backend/src/main/java/com/edufocus/edufocus/report/entity/QuizSubmissionDto.java b/backend/src/main/java/com/edufocus/edufocus/report/entity/dto/QuizSubmissionDto.java similarity index 64% rename from backend/src/main/java/com/edufocus/edufocus/report/entity/QuizSubmissionDto.java rename to backend/src/main/java/com/edufocus/edufocus/report/entity/dto/QuizSubmissionDto.java index 489d896..24413b2 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/entity/QuizSubmissionDto.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/entity/dto/QuizSubmissionDto.java @@ -1,4 +1,4 @@ -package com.edufocus.edufocus.report.entity; +package com.edufocus.edufocus.report.entity.dto; public class QuizSubmissionDto { private Long quizSetId; diff --git a/backend/src/main/java/com/edufocus/edufocus/report/entity/ReportRequset.java b/backend/src/main/java/com/edufocus/edufocus/report/entity/dto/ReportRequset.java similarity index 87% rename from backend/src/main/java/com/edufocus/edufocus/report/entity/ReportRequset.java rename to backend/src/main/java/com/edufocus/edufocus/report/entity/dto/ReportRequset.java index 788f87f..ca20596 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/entity/ReportRequset.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/entity/dto/ReportRequset.java @@ -1,4 +1,4 @@ -package com.edufocus.edufocus.report.entity; +package com.edufocus.edufocus.report.entity.dto; import lombok.Getter; import lombok.Setter; diff --git a/backend/src/main/java/com/edufocus/edufocus/report/entity/dto/ReportResponse.java b/backend/src/main/java/com/edufocus/edufocus/report/entity/dto/ReportResponse.java new file mode 100644 index 0000000..7d6a439 --- /dev/null +++ b/backend/src/main/java/com/edufocus/edufocus/report/entity/dto/ReportResponse.java @@ -0,0 +1,26 @@ +package com.edufocus.edufocus.report.entity.dto; + +import com.edufocus.edufocus.report.entity.vo.Answer; +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; + +import java.util.Date; +import java.util.List; + +@Getter +@Setter +@Builder +public class ReportResponse { + + private Long quizesetId; + private Long userId; + + private String title; + private int allCount; + private int correctCount; + private Date testAt; + + + +} diff --git a/backend/src/main/java/com/edufocus/edufocus/report/entity/Answer.java b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Answer.java similarity index 91% rename from backend/src/main/java/com/edufocus/edufocus/report/entity/Answer.java rename to backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Answer.java index 3204f24..1437626 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/entity/Answer.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Answer.java @@ -1,4 +1,4 @@ -package com.edufocus.edufocus.report.entity; +package com.edufocus.edufocus.report.entity.vo; import com.edufocus.edufocus.quiz.entity.Quiz; diff --git a/backend/src/main/java/com/edufocus/edufocus/report/entity/Report.java b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Report.java similarity index 92% rename from backend/src/main/java/com/edufocus/edufocus/report/entity/Report.java rename to backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Report.java index 6a011d5..6165358 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/entity/Report.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Report.java @@ -1,4 +1,4 @@ -package com.edufocus.edufocus.report.entity; +package com.edufocus.edufocus.report.entity.vo; import com.edufocus.edufocus.quiz.entity.QuizSet; import com.edufocus.edufocus.user.model.entity.User; diff --git a/backend/src/main/java/com/edufocus/edufocus/report/repository/AnswerRepository.java b/backend/src/main/java/com/edufocus/edufocus/report/repository/AnswerRepository.java index 12f76ae..aa2ec9a 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/repository/AnswerRepository.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/repository/AnswerRepository.java @@ -1,6 +1,6 @@ package com.edufocus.edufocus.report.repository; -import com.edufocus.edufocus.report.entity.Answer; +import com.edufocus.edufocus.report.entity.vo.Answer; import org.springframework.data.jpa.repository.JpaRepository; public interface AnswerRepository extends JpaRepository { 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 dd5eca7..954473e 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 @@ -1,6 +1,6 @@ package com.edufocus.edufocus.report.repository; -import com.edufocus.edufocus.report.entity.Report; +import com.edufocus.edufocus.report.entity.vo.Report; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; diff --git a/backend/src/main/java/com/edufocus/edufocus/report/service/AnswerService.java b/backend/src/main/java/com/edufocus/edufocus/report/service/AnswerService.java index 2c4c65a..de98121 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/service/AnswerService.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/service/AnswerService.java @@ -1,6 +1,6 @@ package com.edufocus.edufocus.report.service; -import com.edufocus.edufocus.report.entity.Answer; +import com.edufocus.edufocus.report.entity.vo.Answer; public interface AnswerService { diff --git a/backend/src/main/java/com/edufocus/edufocus/report/service/AnswerServiceImpl.java b/backend/src/main/java/com/edufocus/edufocus/report/service/AnswerServiceImpl.java index b838846..e19f53e 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/service/AnswerServiceImpl.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/service/AnswerServiceImpl.java @@ -1,6 +1,6 @@ package com.edufocus.edufocus.report.service; -import com.edufocus.edufocus.report.entity.Answer; +import com.edufocus.edufocus.report.entity.vo.Answer; import com.edufocus.edufocus.report.repository.AnswerRepository; import jakarta.transaction.Transactional; import lombok.RequiredArgsConstructor; 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 89de34f..bfead76 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 @@ -1,13 +1,14 @@ package com.edufocus.edufocus.report.service; -import com.edufocus.edufocus.report.entity.Report; -import com.edufocus.edufocus.report.entity.ReportRequset; +import com.edufocus.edufocus.report.entity.dto.ReportResponse; +import com.edufocus.edufocus.report.entity.vo.Report; +import com.edufocus.edufocus.report.entity.dto.ReportRequset; import org.springframework.stereotype.Service; import java.sql.SQLException; @Service public interface ReportService { - Report grading(ReportRequset reportRequset) throws SQLException; + ReportResponse grading(ReportRequset reportRequset) throws SQLException; } 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 87f0af0..dd22a44 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 @@ -5,10 +5,11 @@ import com.edufocus.edufocus.quiz.entity.QuizSet; import com.edufocus.edufocus.quiz.repository.QuizRepository; import com.edufocus.edufocus.quiz.service.QuizService; import com.edufocus.edufocus.quiz.service.QuizSetService; -import com.edufocus.edufocus.report.entity.Answer; -import com.edufocus.edufocus.report.entity.AnswerInput; -import com.edufocus.edufocus.report.entity.Report; -import com.edufocus.edufocus.report.entity.ReportRequset; +import com.edufocus.edufocus.report.entity.dto.ReportResponse; +import com.edufocus.edufocus.report.entity.vo.Answer; +import com.edufocus.edufocus.report.entity.dto.AnswerInput; +import com.edufocus.edufocus.report.entity.vo.Report; +import com.edufocus.edufocus.report.entity.dto.ReportRequset; import com.edufocus.edufocus.report.repository.ReportRepository; import com.edufocus.edufocus.user.model.entity.User; import com.edufocus.edufocus.user.model.repository.UserRepository; @@ -36,7 +37,7 @@ public class ReportServiceImpl implements ReportService { @Override - public Report grading(ReportRequset reportRequset) throws SQLException { + public ReportResponse grading(ReportRequset reportRequset) throws SQLException { QuizSet quizSet = quizSetService.findQuizSet(reportRequset.getQuizsetId()); @@ -90,10 +91,15 @@ public class ReportServiceImpl implements ReportService { .allCount(allCount) .correctCount(correctCount) .testAt(new Date()).build(); + ReportResponse reportResponse = ReportResponse.builder() + .quizesetId(quizSet.getId()) + .userId(testuser.getId()) + .title(quizSet.getTitle()) + .allCount(allCount) + .correctCount(correctCount) + .testAt(new Date()) + .build(); - reportRepository.save(report); - return report; - - + return reportResponse; } }