Compare commits

..

2 Commits

Author SHA1 Message Date
eb552f01f0 룰렛 프리셋 API 추가
- 룰렛 만들기
- 룰렛 업데이트
- 룰렛 프리셋 전체 가져오기
2024-02-22 16:04:06 +09:00
95717824c6 룰렛 프리셋 API 추가
- 룰렛 만들기
- 룰렛 업데이트
- 룰렛 프리셋 전체 가져오기
2024-02-22 16:03:37 +09:00

View File

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