Skip to content

Commit

Permalink
Merge pull request #115 from mash-up-kr/junhyoung/remove-unused-anyop…
Browse files Browse the repository at this point in the history
…enpickercount

fix: unused remove anyOpenPickerCount query, field
  • Loading branch information
toychip authored Aug 20, 2024
2 parents 6fded11 + eb5e3a6 commit 5945d18
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 39 deletions.
1 change: 0 additions & 1 deletion api/src/main/kotlin/com/mashup/dojo/PickController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ class PickController(
questionContent = pickDetailPaging.questionContent,
questionEmojiImageUrl = pickDetailPaging.questionEmojiImageUrl,
totalReceivedPickCount = pickDetailPaging.totalReceivedPickCount,
anyOpenPickerCount = pickDetailPaging.anyOpenPickerCount,
picks = pickDetails,
totalPage = pickDetailPaging.totalPage,
totalElements = pickDetailPaging.totalElements,
Expand Down
1 change: 0 additions & 1 deletion api/src/main/kotlin/com/mashup/dojo/dto/PickDto.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ data class PickDetailPaging(
val questionContent: String,
val questionEmojiImageUrl: String,
val totalReceivedPickCount: Int,
val anyOpenPickerCount: Int,
val picks: List<ReceivedPickDetail>,
val totalPage: Int,
val totalElements: Long,
Expand Down
21 changes: 0 additions & 21 deletions entity/src/main/kotlin/com/mashup/dojo/PickRepository.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ interface PickRepositoryCustom {
questionId: String,
): Long

fun getOpenPickerCount(
questionId: String,
memberId: String,
): Long

fun findPickCountByMemberId(memberId: String): Long

fun findSolvedPick(
Expand Down Expand Up @@ -155,22 +150,6 @@ class PickRepositoryImpl(
.fetchOne() ?: 0
}

override fun getOpenPickerCount(
questionId: String,
memberId: String,
): Long {
val pickEntity = QPickEntity.pickEntity
return jpaQueryFactory
.select(Wildcard.count)
.from(pickEntity)
.where(
pickEntity.questionId.eq(questionId),
pickEntity.pickedId.eq(memberId),
isAnyOpen(pickEntity)
)
.fetchOne() ?: 0
}

private fun isAnyOpen(pickEntity: QPickEntity): BooleanExpression? {
return pickEntity.isGenderOpen
.or(pickEntity.isPlatformOpen)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ interface PickService {

fun getNextPickTime(): LocalDateTime

fun getAnyOpenPickerCount(
questionId: QuestionId,
memberId: MemberId,
): Int

fun getReceivedMySpacePicks(memberId: MemberId): List<MySpacePickDetail>

data class GetPickPaging(
Expand Down Expand Up @@ -390,13 +385,6 @@ class DefaultPickService(
return nextPickTime ?: today.plusDays(1).atTime(pickTimes.first())
}

override fun getAnyOpenPickerCount(
questionId: QuestionId,
memberId: MemberId,
): Int {
return pickRepository.getOpenPickerCount(questionId.value, memberId.value).toInt()
}

override fun getReceivedMySpacePicks(memberId: MemberId): List<PickService.MySpacePickDetail> {
return pickRepository.findTopRankPicksByMemberId(memberId = memberId.value, rank = defaultRankSize).map { pick ->
val pickCount = pickRepository.findPickDetailCount(memberId = memberId.value, questionId = pick.questionId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ interface PickUseCase {
val questionContent: String,
val questionEmojiImageUrl: String,
val totalReceivedPickCount: Int,
val anyOpenPickerCount: Int,
val picks: List<PickService.GetReceivedPickDetail>,
val totalPage: Int,
val totalElements: Long,
Expand Down Expand Up @@ -143,14 +142,11 @@ class DefaultPickUseCase(

val receivedPickPaging = pickService.getPickDetailPaging(question.id, command.memberId, command.pageNumber, command.pageSize)

val anyOpenPickerCount = pickService.getAnyOpenPickerCount(question.id, command.memberId)

return PickUseCase.GetPickDetailPaging(
questionId = question.id,
questionContent = question.content,
questionEmojiImageUrl = imageUrl,
totalReceivedPickCount = pickCount,
anyOpenPickerCount = anyOpenPickerCount,
picks = receivedPickPaging.picks,
totalPage = receivedPickPaging.totalPage,
totalElements = receivedPickPaging.totalElements,
Expand Down

0 comments on commit 5945d18

Please sign in to comment.