-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feat] 마이페이지 기능을 일부 구현한다 #25 #31
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
aad4761
feat : 레벨에 따른 틀린문제 조회 구현 (#25)
chaen-ing 0647db0
Docs : 설명 수정 (#25)
chaen-ing 011cbb0
feat : 좋아요한 댓글 불러오기 일부 구현 (#25)
chaen-ing a082ed8
feat : 좋아요한 댓글 불러오기 구현 완료 (#25)
chaen-ing e934e0f
Refact : 퀴즈 컨트롤러 파라미터 삭제 (#25)
chaen-ing 880ea01
Feat : 스크랩 퀴즈 조회 컨트롤러 (#25)
chaen-ing 7901edb
Feat : 리포지토리에 개별 패키지 생성 (#25)
chaen-ing 80ab9d8
Feat : 퀴즈 스크랩 쿼리 작성 (#25)
chaen-ing 32db674
Feat : DTO, 서비스로직 작성 (#25)
chaen-ing 083e9d9
Feat : 파라미터로 레벨 추가 (#25)
chaen-ing 24c4ab9
Debug : 퀴즈 중복 저장 로직 추가 (#25)
chaen-ing 5745704
Debug : 학습 중복 저장 로직 추가 (#25)
chaen-ing 0f368b2
Feat : DTO, 조회 로직 구현 (#25)
chaen-ing 3c7d3b4
Feat : Response 변경 (#25)
chaen-ing e75ebac
Feat : 개별 개념 학습 조회 추가 (#25)
chaen-ing 7b90012
Refact : 틀린 문제 조회 로직 QueryDSL로 변경(#25)
chaen-ing 7ef0584
Refact : response에서 createDate 포맷 설정 (#25)
chaen-ing File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
11 changes: 11 additions & 0 deletions
11
src/main/java/com/ripple/BE/learning/dto/FailQuizListDTO.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,11 @@ | ||
package com.ripple.BE.learning.dto; | ||
|
||
import com.ripple.BE.learning.domain.quiz.Quiz; | ||
import java.util.List; | ||
|
||
public record FailQuizListDTO(List<QuizDTO> failQuizList) { | ||
|
||
public static FailQuizListDTO toFailQuizListDTO(final List<Quiz> quizList) { | ||
return new FailQuizListDTO(quizList.stream().map(QuizDTO::toFailQuizDTO).toList()); | ||
} | ||
} |
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
15 changes: 15 additions & 0 deletions
15
src/main/java/com/ripple/BE/learning/dto/response/ConceptDetailResponse.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,15 @@ | ||
package com.ripple.BE.learning.dto.response; | ||
|
||
import com.ripple.BE.learning.dto.ConceptDTO; | ||
|
||
public record ConceptDetailResponse( | ||
long id, String name, String explanation, String level, String learningSetName) { | ||
public static ConceptDetailResponse toConceptDetailResponse(ConceptDTO conceptDTO) { | ||
return new ConceptDetailResponse( | ||
conceptDTO.conceptId(), | ||
conceptDTO.name(), | ||
conceptDTO.explanation(), | ||
conceptDTO.level().name(), | ||
conceptDTO.learningSetName()); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/ripple/BE/learning/dto/response/FailQuizListResponse.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,11 @@ | ||
package com.ripple.BE.learning.dto.response; | ||
|
||
import com.ripple.BE.learning.dto.FailQuizListDTO; | ||
import java.util.List; | ||
|
||
public record FailQuizListResponse(List<FailQuizResponse> failQuizList) { | ||
public static FailQuizListResponse toFailQuizListResponse(final FailQuizListDTO failQuizListDTO) { | ||
return new FailQuizListResponse( | ||
failQuizListDTO.failQuizList().stream().map(FailQuizResponse::toFailQuizResponse).toList()); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/ripple/BE/learning/dto/response/FailQuizResponse.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,9 @@ | ||
package com.ripple.BE.learning.dto.response; | ||
|
||
import com.ripple.BE.learning.dto.QuizDTO; | ||
|
||
public record FailQuizResponse(Long id, String name, String learningSet) { | ||
public static FailQuizResponse toFailQuizResponse(final QuizDTO quizDTO) { | ||
return new FailQuizResponse(quizDTO.id(), quizDTO.name(), quizDTO.learningSetName()); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/ripple/BE/learning/dto/response/ScrapConceptListResponse.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,13 @@ | ||
package com.ripple.BE.learning.dto.response; | ||
|
||
import com.ripple.BE.learning.dto.ConceptListDTO; | ||
import java.util.List; | ||
|
||
public record ScrapConceptListResponse(List<ScrapConceptResponse> scrapConceptList) { | ||
public static ScrapConceptListResponse toScrapConceptListResponse(ConceptListDTO conceptListDTO) { | ||
return new ScrapConceptListResponse( | ||
conceptListDTO.conceptList().stream() | ||
.map(ScrapConceptResponse::toScrapConceptResponse) | ||
.toList()); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/com/ripple/BE/learning/dto/response/ScrapConceptResponse.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,17 @@ | ||
package com.ripple.BE.learning.dto.response; | ||
|
||
import com.ripple.BE.learning.dto.ConceptDTO; | ||
import com.ripple.BE.user.domain.type.Level; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
public record ScrapConceptResponse(long id, String name, String LearningSetName, Level level) { | ||
public static ScrapConceptResponse toScrapConceptResponse(ConceptDTO conceptDTO) { | ||
return ScrapConceptResponse.builder() | ||
.id(conceptDTO.conceptId()) | ||
.name(conceptDTO.name()) | ||
.LearningSetName(conceptDTO.learningSetName()) | ||
.level(conceptDTO.level()) | ||
.build(); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/ripple/BE/learning/dto/response/ScrapQuizListResponse.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,11 @@ | ||
package com.ripple.BE.learning.dto.response; | ||
|
||
import com.ripple.BE.learning.dto.QuizListDTO; | ||
import java.util.List; | ||
|
||
public record ScrapQuizListResponse(List<ScrapQuizResponse> scrapQuizList) { | ||
public static ScrapQuizListResponse toScrapQuizListResponse(final QuizListDTO quizListDTO) { | ||
return new ScrapQuizListResponse( | ||
quizListDTO.quizList().stream().map(ScrapQuizResponse::toScrapQuizResponse).toList()); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/ripple/BE/learning/dto/response/ScrapQuizResponse.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,18 @@ | ||
package com.ripple.BE.learning.dto.response; | ||
|
||
import com.ripple.BE.learning.dto.QuizDTO; | ||
import com.ripple.BE.user.domain.type.Level; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
public record ScrapQuizResponse(long quizId, String quizName, String learningSetName, Level level) { | ||
|
||
public static ScrapQuizResponse toScrapQuizResponse(QuizDTO quizDTO) { | ||
return builder() | ||
.quizId(quizDTO.id()) | ||
.quizName(quizDTO.name()) | ||
.learningSetName(quizDTO.learningSetName()) | ||
.level(quizDTO.level()) | ||
.build(); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
src/main/java/com/ripple/BE/learning/exception/LearningException.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,12 +1,12 @@ | ||
package com.ripple.BE.learning.exception; | ||
|
||
import com.ripple.BE.global.exception.errorcode.ErrorCode; | ||
import com.ripple.BE.learning.exception.errorcode.LearningErrorCode; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public class LearningException extends RuntimeException { | ||
|
||
private final ErrorCode errorCode; | ||
private final LearningErrorCode errorCode; | ||
} |
4 changes: 2 additions & 2 deletions
4
src/main/java/com/ripple/BE/learning/exception/QuizException.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,12 +1,12 @@ | ||
package com.ripple.BE.learning.exception; | ||
|
||
import com.ripple.BE.global.exception.errorcode.ErrorCode; | ||
import com.ripple.BE.learning.exception.errorcode.QuizErrorCode; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public class QuizException extends RuntimeException { | ||
|
||
private final ErrorCode errorCode; | ||
private final QuizErrorCode errorCode; | ||
} |
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
8 changes: 0 additions & 8 deletions
8
src/main/java/com/ripple/BE/learning/repository/ConceptScrapRepository.java
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
src/main/java/com/ripple/BE/learning/repository/QuizScrapRepository.java
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...earning/repository/ConceptRepository.java → ...repository/concept/ConceptRepository.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
11 changes: 11 additions & 0 deletions
11
src/main/java/com/ripple/BE/learning/repository/conceptScrap/ConceptScrapRepository.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,11 @@ | ||
package com.ripple.BE.learning.repository.conceptScrap; | ||
|
||
import com.ripple.BE.learning.domain.concept.ConceptScrap; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface ConceptScrapRepository | ||
extends JpaRepository<ConceptScrap, Long>, ConceptScrapRepositoryCustom { | ||
Boolean existsByConcept_ConceptIdAndUserId(Long conceptId, Long userId); | ||
} |
10 changes: 10 additions & 0 deletions
10
...ain/java/com/ripple/BE/learning/repository/conceptScrap/ConceptScrapRepositoryCustom.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.ripple.BE.learning.repository.conceptScrap; | ||
|
||
import com.ripple.BE.learning.domain.concept.Concept; | ||
import com.ripple.BE.user.domain.type.Level; | ||
import java.util.List; | ||
|
||
public interface ConceptScrapRepositoryCustom { | ||
|
||
List<Concept> findConceptsScrappedByUserAndLevel(Long userId, Level level); | ||
} |
26 changes: 26 additions & 0 deletions
26
...java/com/ripple/BE/learning/repository/conceptScrap/ConceptScrapRepositoryCustomImpl.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,26 @@ | ||
package com.ripple.BE.learning.repository.conceptScrap; | ||
|
||
import static com.ripple.BE.learning.domain.concept.QConcept.*; | ||
import static com.ripple.BE.learning.domain.concept.QConceptScrap.*; | ||
|
||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import com.ripple.BE.learning.domain.concept.Concept; | ||
import com.ripple.BE.user.domain.type.Level; | ||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@RequiredArgsConstructor | ||
public class ConceptScrapRepositoryCustomImpl implements ConceptScrapRepositoryCustom { | ||
|
||
private final JPAQueryFactory queryFactory; | ||
|
||
@Override | ||
public List<Concept> findConceptsScrappedByUserAndLevel(Long userId, Level level) { | ||
return queryFactory | ||
.select(concept) | ||
.from(conceptScrap) | ||
.join(conceptScrap.concept, concept) | ||
.where(conceptScrap.user.id.eq(userId), concept.level.eq(level)) | ||
.fetch(); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ing/repository/LearningSetRepository.java → ...ry/learningSet/LearningSetRepository.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
2 changes: 1 addition & 1 deletion
2
...repository/UserLearningSetRepository.java → ...earningSet/UserLearningSetRepository.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
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
10 changes: 10 additions & 0 deletions
10
src/main/java/com/ripple/BE/learning/repository/quiz/QuizRepositoryCustom.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.ripple.BE.learning.repository.quiz; | ||
|
||
import com.ripple.BE.learning.domain.quiz.Quiz; | ||
import com.ripple.BE.user.domain.type.Level; | ||
import java.util.List; | ||
|
||
public interface QuizRepositoryCustom { | ||
|
||
List<Quiz> findFailedQuizzesByUserAndLevel(long userId, Level level); | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/ripple/BE/learning/repository/quiz/QuizRepositoryCustomImpl.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,26 @@ | ||
package com.ripple.BE.learning.repository.quiz; | ||
|
||
import static com.ripple.BE.learning.domain.quiz.QFailQuiz.*; | ||
import static com.ripple.BE.learning.domain.quiz.QQuiz.*; | ||
|
||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import com.ripple.BE.learning.domain.quiz.Quiz; | ||
import com.ripple.BE.user.domain.type.Level; | ||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@RequiredArgsConstructor | ||
public class QuizRepositoryCustomImpl implements QuizRepositoryCustom { | ||
|
||
private final JPAQueryFactory queryFactory; | ||
|
||
@Override | ||
public List<Quiz> findFailedQuizzesByUserAndLevel(long userId, Level level) { | ||
return queryFactory | ||
.select(quiz) | ||
.from(failQuiz) | ||
.join(failQuiz.quiz, quiz) | ||
.where(failQuiz.user.id.eq(userId), quiz.level.eq(level)) | ||
.fetch(); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기 혹시 _ 쓰신 이유 알수 있을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept클래스의 id가 conceptId로 되어있어서 existByConceptIdAndUserID 이거로는 조회가 안되더라구요!! 필드명 바꾸면 고칠게많을 것 같아서 언더바로 해결했습니다ㅎㅎ..