-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feature: 퀴즈 정답 제출 구현 * refactor: 퀴즈 정답 제출 api 수정 --------- Co-authored-by: sleepyhoon <[email protected]>
- Loading branch information
1 parent
0922875
commit dca0cd4
Showing
12 changed files
with
146 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/main/java/com/goldbalance/dive/domain/article/dto/request/QuizRecordRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.goldbalance.dive.domain.article.dto.request; | ||
|
||
import com.goldbalance.dive.domain.article.domain.OptionType; | ||
|
||
public record QuizRecordRequest(Long quizId, int number, OptionType answer) {} |
5 changes: 5 additions & 0 deletions
5
src/main/java/com/goldbalance/dive/domain/article/dto/request/QuizRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.goldbalance.dive.domain.article.dto.request; | ||
|
||
import java.util.List; | ||
|
||
public record QuizRequest(String nickname, int totalQuizzes, List<QuizRecordRequest> quizzes) {} |
3 changes: 3 additions & 0 deletions
3
src/main/java/com/goldbalance/dive/domain/article/dto/response/QuizRecordResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.goldbalance.dive.domain.article.dto.response; | ||
|
||
public record QuizRecordResponse(Long quizId, int number, String submittedAnswer, String correctAnswer) {} |
31 changes: 31 additions & 0 deletions
31
src/main/java/com/goldbalance/dive/domain/article/dto/response/QuizResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.goldbalance.dive.domain.article.dto.response; | ||
|
||
import com.goldbalance.dive.domain.member.domain.Member; | ||
import java.util.List; | ||
|
||
public record QuizResult( | ||
String nickname, | ||
long earnedMileages, | ||
long totalMileages, | ||
int totalQuizzes, | ||
int correctQuizzes, | ||
String title, | ||
List<QuizRecordResponse> response) { | ||
|
||
public static QuizResult of( | ||
Member member, | ||
long earnedMileages, | ||
int totalQuizzes, | ||
int correctQuizzes, | ||
String title, | ||
List<QuizRecordResponse> response) { | ||
return new QuizResult( | ||
member.getNickname(), | ||
earnedMileages, | ||
member.getTotalMileage(), | ||
totalQuizzes, | ||
correctQuizzes, | ||
title, | ||
response); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/goldbalance/dive/domain/article/repository/AnswerRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.goldbalance.dive.domain.article.repository; | ||
|
||
import com.goldbalance.dive.domain.article.domain.Answer; | ||
import java.util.Optional; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface AnswerRepository extends JpaRepository<Answer, Long> { | ||
|
||
Optional<Answer> findByQuizId(Long quizId); | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/com/goldbalance/dive/domain/article/repository/quiz/QuizCustomRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
package com.goldbalance.dive.domain.article.repository.quiz; | ||
|
||
import com.goldbalance.dive.domain.article.domain.Answer; | ||
import com.goldbalance.dive.domain.article.domain.Quiz; | ||
import com.goldbalance.dive.domain.article.dto.request.QuizRequest; | ||
import java.util.List; | ||
|
||
public interface QuizCustomRepository { | ||
List<Quiz> searchQuiz(Long articleId); | ||
|
||
List<Answer> getAnswers(QuizRequest quizRequest); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters