From 183f8098be297f245757d01e5c1fb62ea14d577b Mon Sep 17 00:00:00 2001 From: Klaus <klaus@vividnext.co.kr> Date: Thu, 22 Feb 2024 17:26:11 +0900 Subject: [PATCH] findBy -> findAllBy --- .../sodalive/live/roulette/NewRouletteRepository.kt | 4 ++-- .../sodalive/live/roulette/NewRouletteService.kt | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/live/roulette/NewRouletteRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/live/roulette/NewRouletteRepository.kt index fca5623..76cf94f 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/live/roulette/NewRouletteRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/live/roulette/NewRouletteRepository.kt @@ -3,6 +3,6 @@ package kr.co.vividnext.sodalive.live.roulette import org.springframework.data.repository.CrudRepository interface NewRouletteRepository : CrudRepository<NewRoulette, Long> { - fun findByCreatorId(creatorId: Long): List<NewRoulette> - fun findByCreatorIdAndActive(creatorId: Long, isActive: Boolean): List<NewRoulette> + fun findAllByCreatorId(creatorId: Long): List<NewRoulette> + fun findAllByCreatorIdAndActive(creatorId: Long, isActive: Boolean): List<NewRoulette> } diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/live/roulette/NewRouletteService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/live/roulette/NewRouletteService.kt index 1a0bd72..691343d 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/live/roulette/NewRouletteService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/live/roulette/NewRouletteService.kt @@ -36,7 +36,7 @@ class NewRouletteService( fun getAllRoulette(creatorId: Long, memberId: Long): List<GetNewRouletteResponse> { if (creatorId != memberId) throw SodaException("잘못된 요청입니다.") - var rouletteList = repository.findByCreatorId(creatorId) + var rouletteList = repository.findAllByCreatorId(creatorId) println(rouletteList) if (rouletteList.isEmpty()) { val roulette = oldRepository.findByIdOrNull(creatorId) @@ -54,7 +54,7 @@ class NewRouletteService( ) ) - rouletteList = repository.findByCreatorId(creatorId) + rouletteList = repository.findAllByCreatorId(creatorId) } } @@ -108,7 +108,7 @@ class NewRouletteService( } fun getRoulette(creatorId: Long, memberId: Long): GetRouletteResponse { - val roulette = repository.findByCreatorIdAndActive(creatorId = creatorId, isActive = true) + val roulette = repository.findAllByCreatorIdAndActive(creatorId = creatorId, isActive = true) if (roulette.isEmpty() || !roulette[0].isActive || roulette[0].items.isEmpty()) { throw SodaException("룰렛을 사용할 수 없습니다.") @@ -134,7 +134,7 @@ class NewRouletteService( } // STEP 2 - 룰렛 데이터 가져오기 - val rouletteList = repository.findByCreatorIdAndActive(creatorId = host.id!!, isActive = true) + val rouletteList = repository.findAllByCreatorIdAndActive(creatorId = host.id!!, isActive = true) if (rouletteList.isEmpty() || !rouletteList[0].isActive || rouletteList[0].items.isEmpty()) { throw SodaException("룰렛을 사용할 수 없습니다.")