Compare commits

..

No commits in common. "eb552f01f0d6aff531782f2395bc32112c950ccb" and "f36965071182ae7538e9b837b5107e54b8afd2df" have entirely different histories.

1 changed files with 3 additions and 6 deletions

View File

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