login fix and spaces creation

This commit is contained in:
xds
2025-03-06 18:55:12 +03:00
parent 3b9f0e566c
commit 98263732ca
5 changed files with 71 additions and 77 deletions

View File

@@ -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
}