Skip to content

Commit

Permalink
Merge pull request #135 from TeamMiso/hotfix/push-notification-logic-fix
Browse files Browse the repository at this point in the history
푸시 알림 오류 수정
  • Loading branch information
uuuuuuuk authored Dec 20, 2023
2 parents eaf7f26 + fce51bb commit a10ca85
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ import org.springframework.data.repository.CrudRepository

interface InquiryRepository : CrudRepository<Inquiry, Long> {

fun findByUser(user: User): List<Inquiry>?
fun findAllByOrderByCreatedDateDesc(): List<Inquiry>

fun findByUserOrderByCreatedDateDesc(user: User): List<Inquiry>?
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ListAllInquiryServiceImpl(
) : ListAllInquiryService {

override fun execute(): ListInquiryResponseDto = ListInquiryResponseDto(
inquiryList = inquiryRepository.findAll()
inquiryList = inquiryRepository.findAllByOrderByCreatedDateDesc()
.map { InquiryResponseDto(it) }
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ListMyInquiryServiceImpl(

val user = userUtil.currentUser()

val inquiry = inquiryRepository.findByUser(user)
val inquiry = inquiryRepository.findByUserOrderByCreatedDateDesc(user)
?: throw InquiryNotFoundException()

return ListInquiryResponseDto(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class RespondInquiryServiceImpl(

inquiry.updateInquiryStatus(InquiryStatus.COMPLETE)

val token = deviceTokenRepository.findByUser(user)
val token = deviceTokenRepository.findByUser(inquiry.user)

token?.let { inquiryNotificationSendService.execute(inquiry, token.token)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import org.springframework.data.repository.CrudRepository

interface PurchaseRepository : CrudRepository<Purchase, Long> {

fun findAllByUser(user: User): List<Purchase>?
fun findAllByUserOrderByCreatedDateDesc(user: User): List<Purchase>?
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ListMyPurchaseItemServiceImpl(

val user = userUtil.currentUser()

val purchase = purchaseRepository.findAllByUser(user)
val purchase = purchaseRepository.findAllByUserOrderByCreatedDateDesc(user)
?: throw PurchaseNotFoundException()

return ListMyPurchaseItemResponseDto(
Expand Down

0 comments on commit a10ca85

Please sign in to comment.