Author SHA1 Message Date
jieun 995e69e302 Add quiz repository query methods 2026-10-20 20:33:50 +09:00
jieun 698bb0e99f Add exam attempt history summary DTO 2026-10-20 20:29:13 +09:00
jieun 3c0455bff7 Add exam grading result DTOs 2026-10-20 20:26:18 +09:00
jieun ed109df111 Add exam answer submission DTOs 2026-10-20 20:22:38 +09:00
jieun e8de49732b Add exam question and choice view DTOs 2026-10-20 20:20:06 +09:00
jieun 123261aad3 Add exam start request and response DTOs 2026-10-20 20:17:02 +09:00
11 changed files with 72 additions and 0 deletions

No files matched your search

@@ -2,6 +2,7 @@ package com.example.questionbank.repository;
import com.example.questionbank.domain.ExamAttempt;
import java.util.List;
import java.util.List;
import java.util.Optional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
@@ -14,6 +15,8 @@ import org.springframework.stereotype.Repository;
*/
@Repository
public interface ExamAttemptRepository extends JpaRepository<ExamAttempt, Long> {
List<ExamAttempt> findAllByUserLogin(String login);
@Query("select examAttempt from ExamAttempt examAttempt where examAttempt.user.login = ?#{authentication.name}")
List<ExamAttempt> findByUserIsCurrentUser();
@@ -2,6 +2,7 @@ package com.example.questionbank.repository;
import com.example.questionbank.domain.Question;
import java.util.List;
import java.util.List;
import java.util.Optional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
@@ -14,6 +15,8 @@ import org.springframework.stereotype.Repository;
*/
@Repository
public interface QuestionRepository extends JpaRepository<Question, Long> {
List<Question> findAllBySubjectIdAndActiveTrue(Long subjectId);
default Optional<Question> findOneWithEagerRelationships(Long id) {
return this.findOneWithToOneRelationships(id);
}
@@ -0,0 +1,13 @@
package com.example.questionbank.web.rest.dto;
import com.example.questionbank.domain.enumeration.OptionKey;
public record AnswerResult(
Long questionId,
String questionText,
OptionKey selectedOption,
String selectedContent,
boolean correct,
int awardedPoints,
String explanation
) {}
@@ -0,0 +1,5 @@
package com.example.questionbank.web.rest.dto;
import com.example.questionbank.domain.enumeration.OptionKey;
public record ChoiceView(OptionKey optionKey, String content, Integer displayOrder) {}
@@ -0,0 +1,5 @@
package com.example.questionbank.web.rest.dto;
import java.time.Instant;
public record ExamAttemptStartResult(Long attemptId, Instant startedAt) {}
@@ -0,0 +1,14 @@
package com.example.questionbank.web.rest.dto;
import com.example.questionbank.domain.enumeration.AttemptStatus;
import java.time.Instant;
public record ExamAttemptSummary(
Long attemptId,
Long subjectId,
String subjectName,
Instant startedAt,
Instant submittedAt,
AttemptStatus status,
Integer score
) {}
@@ -0,0 +1,5 @@
package com.example.questionbank.web.rest.dto;
import java.util.List;
public record ExamQuestionView(Long questionId, String prompt, List<ChoiceView> choices) {}
@@ -0,0 +1,6 @@
package com.example.questionbank.web.rest.dto;
import java.time.Instant;
import java.util.List;
public record ExamResult(Long attemptId, int totalScore, Instant submittedAt, List<AnswerResult> answers) {}
@@ -0,0 +1,5 @@
package com.example.questionbank.web.rest.dto;
import jakarta.validation.constraints.NotNull;
public record StartExamRequest(@NotNull Long subjectId) {}
@@ -0,0 +1,6 @@
package com.example.questionbank.web.rest.dto;
import com.example.questionbank.domain.enumeration.OptionKey;
import jakarta.validation.constraints.NotNull;
public record SubmitAnswerRequest(@NotNull Long questionId, OptionKey selectedOption) {}
@@ -0,0 +1,7 @@
package com.example.questionbank.web.rest.dto;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import java.util.List;
public record SubmitExamRequest(@NotEmpty List<@Valid SubmitAnswerRequest> answers) {}