login fix and spaces creation
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package space.luminic.budgerapp.services
|
||||
|
||||
import kotlinx.coroutines.reactor.awaitSingle
|
||||
import org.springframework.cache.annotation.CacheEvict
|
||||
import org.springframework.stereotype.Service
|
||||
import reactor.core.publisher.Mono
|
||||
@@ -12,14 +13,14 @@ import java.time.LocalDateTime
|
||||
class TokenService(private val tokenRepository: TokenRepo) {
|
||||
|
||||
@CacheEvict("tokens", allEntries = true)
|
||||
fun saveToken(token: String, username: String, expiresAt: LocalDateTime): Mono<Token> {
|
||||
suspend fun saveToken(token: String, username: String, expiresAt: LocalDateTime): Token {
|
||||
val newToken = Token(
|
||||
token = token,
|
||||
username = username,
|
||||
issuedAt = LocalDateTime.now(),
|
||||
expiresAt = expiresAt
|
||||
)
|
||||
return tokenRepository.save(newToken)
|
||||
return tokenRepository.save(newToken).awaitSingle()
|
||||
}
|
||||
|
||||
fun getToken(token: String): Mono<Token> {
|
||||
|
||||
Reference in New Issue
Block a user