added basic create account
- add link in to creat in users.html - AccountController - add getCreateAccount - add postCreateAccount - add create.html - add AccountForm to Account Request in Mapping.kt - add AccountForm - add addAccount to AccountRegistryService - add accountRegistryCreate to WebClientCalls.kt - add UsernameDuplicateException - add AccountRegistryException - add HlaejaException
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
package ltd.hlaeja.service
|
||||
|
||||
import io.github.oshai.kotlinlogging.KotlinLogging
|
||||
import ltd.hlaeja.exception.AccountRegistryException
|
||||
import ltd.hlaeja.library.accountRegistry.Account
|
||||
import ltd.hlaeja.library.accountRegistry.Authentication
|
||||
import ltd.hlaeja.property.AccountRegistryProperty
|
||||
import ltd.hlaeja.util.accountRegistryAccounts
|
||||
import ltd.hlaeja.util.accountRegistryAuthenticate
|
||||
import ltd.hlaeja.util.accountRegistryCreate
|
||||
import org.springframework.http.HttpStatus.BAD_REQUEST
|
||||
import org.springframework.security.authentication.AuthenticationServiceException
|
||||
import org.springframework.security.core.AuthenticationException
|
||||
@@ -54,4 +56,14 @@ class AccountRegistryService(
|
||||
size: Int,
|
||||
): Flux<Account.Response> = webClient.accountRegistryAccounts(page, size, property)
|
||||
.onErrorResume { error -> Flux.error(ResponseStatusException(BAD_REQUEST, error.message, error)) }
|
||||
|
||||
fun addAccount(
|
||||
request: Account.Request,
|
||||
): Mono<Account.Response> = webClient.accountRegistryCreate(request, property)
|
||||
.onErrorResume { error ->
|
||||
when (error) {
|
||||
is AccountRegistryException -> Mono.error(error)
|
||||
else -> Mono.error(ResponseStatusException(BAD_REQUEST, error.message))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user