login fix and spaces creation
This commit is contained in:
@@ -4,6 +4,7 @@ import kotlinx.coroutines.coroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.reactive.awaitFirst
|
||||
import kotlinx.coroutines.reactive.awaitFirstOrNull
|
||||
import kotlinx.coroutines.reactive.awaitLast
|
||||
import kotlinx.coroutines.reactive.awaitSingle
|
||||
import kotlinx.coroutines.reactor.awaitSingleOrNull
|
||||
import org.bson.Document
|
||||
@@ -18,6 +19,7 @@ import space.luminic.budgerapp.configs.AuthException
|
||||
import space.luminic.budgerapp.models.*
|
||||
import space.luminic.budgerapp.repos.*
|
||||
import java.time.LocalDateTime
|
||||
import java.time.ZoneId
|
||||
import java.util.UUID
|
||||
|
||||
@Service
|
||||
@@ -92,7 +94,8 @@ class SpaceService(
|
||||
username = userDoc.getString("username"),
|
||||
firstName = userDoc.getString("firstName")
|
||||
)
|
||||
}.toMutableList()
|
||||
}.toMutableList(),
|
||||
createdAt = doc.getDate("createdAt").toInstant().atZone(ZoneId.systemDefault()).toLocalDate()
|
||||
)
|
||||
}
|
||||
}.awaitFirst()
|
||||
@@ -120,7 +123,7 @@ class SpaceService(
|
||||
.map { category ->
|
||||
category.copy(id = null, space = savedSpace) // Создаем новую копию
|
||||
}
|
||||
categoryRepo.saveAll(categories).awaitSingle()
|
||||
categoryRepo.saveAll(categories).awaitLast()
|
||||
savedSpace
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user