룰렛 프리셋 API 추가

- 룰렛 만들기
- 룰렛 업데이트
- 룰렛 프리셋 전체 가져오기
This commit is contained in:
Klaus 2024-02-22 16:03:37 +09:00
parent f369650711
commit 95717824c6
1 changed files with 3 additions and 3 deletions

View File

@ -36,11 +36,11 @@ class NewRouletteService(
fun getAllRoulette(creatorId: Long, memberId: Long): List<GetNewRouletteResponse> { fun getAllRoulette(creatorId: Long, memberId: Long): List<GetNewRouletteResponse> {
if (creatorId != memberId) throw SodaException("잘못된 요청입니다.") if (creatorId != memberId) throw SodaException("잘못된 요청입니다.")
val rouletteList = repository.findByCreatorId(creatorId) var rouletteList = repository.findByCreatorId(creatorId)
if (rouletteList.isEmpty()) { if (rouletteList.isEmpty()) {
val roulette = oldRepository.findByIdOrNull(creatorId) val roulette = oldRepository.findByIdOrNull(creatorId)
if (roulette != null) { if (roulette != null) {
val newRoulette = repository.save( repository.save(
NewRoulette( NewRoulette(
id = idGenerator.generateId(SEQUENCE_NAME), id = idGenerator.generateId(SEQUENCE_NAME),
creatorId = creatorId, creatorId = creatorId,
@ -50,7 +50,7 @@ class NewRouletteService(
) )
) )
rouletteList.toMutableList().add(newRoulette) rouletteList = repository.findByCreatorId(creatorId)
} }
} }