-
Notifications
You must be signed in to change notification settings - Fork 1
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: problem 도메인 1차 구현 #49
Conversation
api/src/main/kotlin/com/few/api/web/usecase/problem/out/ReadProblemUseCaseOut.kt
Outdated
Show resolved
Hide resolved
api/src/main/kotlin/com/few/api/web/usecase/problem/CheckProblemUseCase.kt
Show resolved
Hide resolved
val submitAns = useCaseIn.sub | ||
|
||
val record = problemDao.selectProblemAnswer(SelectProblemAnswerQuery(problemId)) | ||
val isSolved = submitAns.equals(record.answer) |
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.
record.answer.equals(submitAns)
위와 같이 순서를 변경하거나
submitAns는 모델을 만들어 처리하는게 어떨까요?
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.
아,, 이런거 생각하면 JPA가 좋긴 하구나...
api/src/main/kotlin/com/few/api/web/usecase/problem/CheckProblemUseCase.kt
Show resolved
Hide resolved
|
||
val record = problemDao.selectProblemContents(SelectProblemQuery(problemId)) | ||
|
||
val contents: List<ReadProblemContentsUseCaseOut> = objectMapper.readValue(record.contents) |
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.
요거는 제가 contents 관련 mapper와 객체를 만들었는데 같이 사용하는 것은 어떨까요?
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.
json string <-> kotlin class 매퍼인가요?
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.
5ac7303 요런거요
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.
이거 근데 uc 단에서도 한번 바꿔주고 컨트롤러단에서도 response로 또 한번 바꿔줘야겠네요...
api-repo/src/main/kotlin/com/few/api/repo/dao/problem/ProblemDao.kt
Outdated
Show resolved
Hide resolved
.where(Problem.PROBLEM.ID.eq(query.problemId)) | ||
.fetchOne() | ||
|
||
result ?: throw RuntimeException("Problem with ID ${query.problemId} not found") // TODO: 에러 표준화 |
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.
저는 잘못된 인자로 조회했어! 라는 의미로 IllegalArgumentException를 주로 사용해 오기는 했는데 어떤 예외를 상속에 사용하는게 좋을까요?
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.
저도 주석으로 에러 표준화라고 적어두긴 했는데 자바꺼 말고 저희단에서 예외 클래스 만들어서 쓰는건 어떨까요
api-repo/src/main/resources/db/migration/entity/V1.00.0.0__draft_table_design.sql
Outdated
Show resolved
Hide resolved
api/src/main/kotlin/com/few/api/web/controller/problem/ProblemController.kt
Show resolved
Hide resolved
api/src/main/kotlin/com/few/api/web/controller/problem/ProblemController.kt
Show resolved
Hide resolved
@belljun3395 종준님 컨트롤러 테스트 시 포트를 띄워야 하기 때문에 WAS가 올라가야 하는데 이때 데이터소스 같은 불필요한 클래스는 컨테이너에 로딩되지 않도록 설정필요합니다. 코파일럿의 힘을 빌려 함 해주세요 |
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.
9c23cae
Problem 도메인에서 ProblemId로 조회하는 경우에는 ByProblemId를 안붙이고
추후 Title이나 다른 것으로 조회하는 경우에만 ByTitle 이런 식으로 붙이는게 어떨까요?
ReadProblemContentsUseCaseOutDetail(4L, "투명성") | ||
) | ||
) | ||
Mockito.`when`(readProblemUseCase.execute(ArgumentMatchers.any())) |
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.
저는 요렇게 any 처리가 NPE 뜨면서 안되던데 혹시 테스트 성공하나요?
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.
val problemId = 1L
Mockito.`when`(readProblemUseCase.execute(ReadProblemUseCaseIn(problemId)))
.thenReturn(useCaseOut)
요렇게 테스트 코드 수정해주시면 될 것 같아요
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.
테스트 코드만 동작하도록 수정하고 머지하면 될 것 같아요!
수고하셨습니다~!
ReadProblemContentsUseCaseOutDetail(4L, "투명성") | ||
) | ||
) | ||
Mockito.`when`(readProblemUseCase.execute(ArgumentMatchers.any())) |
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.
val problemId = 1L
Mockito.`when`(readProblemUseCase.execute(ReadProblemUseCaseIn(problemId)))
.thenReturn(useCaseOut)
요렇게 테스트 코드 수정해주시면 될 것 같아요
api/src/test/kotlin/com/few/api/web/controller/problem/ProblemControllerTest.kt
Outdated
Show resolved
Hide resolved
@belljun3395 네넵 좋습니다 ID로 조회하는 것만 네이밍에서 제외할게요 |
🎫 연관 이슈
resolved #48
💁♂️ PR 내용
🙏 작업
아래 2개 API 신규 구현
🙈 PR 참고 사항
📸 스크린샷
🤖 테스트 체크리스트