Skip to content

Commit

Permalink
⚡️: fix 코드리뷰 반영(!! to ?) #38
Browse files Browse the repository at this point in the history
  • Loading branch information
sookyungg committed Apr 14, 2024
1 parent ad00e46 commit 40ea215
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.th.plu.api.controller.answer.dto.response.EveryAnswerInfoResponse
import com.th.plu.api.service.like.LikeValidator
import com.th.plu.common.exception.code.ErrorCode
import com.th.plu.common.exception.model.ConflictException
import com.th.plu.common.exception.model.IllegalArgumentException
import com.th.plu.domain.domain.answer.AnswerRegister
import com.th.plu.domain.domain.answer.AnswerWriting
import com.th.plu.domain.domain.answer.WritingAnswerResult
Expand Down Expand Up @@ -73,6 +74,7 @@ class AnswerService(
fun findAllAnswerInfo(): EveryAnswerInfoResponse {
val todayQuestion = questionExplorer.findTodayQuestion()
val answerCount = answerRepository.findPublicAnswersCountByQuestionId(todayQuestion.id)
?: throw IllegalArgumentException(ErrorCode.Illegal_ARGUMENT_ANSWER_COUNT_EXCEPTION, "answerCount는 비어 있을 수 없습니다.")

return EveryAnswerInfoResponse.of(todayQuestion, answerCount)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ enum class ErrorCode(val code: String, val message: String) {

// Illegal Argument Exception
Illegal_ARGUMENT_NICKNAME_EXCEPTION("IA001", "잘못된 닉네임 형식입니다."),
Illegal_ARGUMENT_ANSWER_COUNT_EXCEPTION("IA002", "answerCount는 비어있을 수 없습니다."),
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface AnswerRepositoryCustom {

fun findEveryAnswersWithCursorAndPageSize(questionId: Long, lastAnswerId: Long, pageSize: Long): List<EveryAnswerRetrieveResponse>

fun findPublicAnswersCountByQuestionId(questionId: Long): Long
fun findPublicAnswersCountByQuestionId(questionId: Long): Long?

fun findPublicAnswersLikeTopN(questionId: Long, getCount: Long): List<EveryAnswerRetrieveResponse>
}

0 comments on commit 40ea215

Please sign in to comment.