added basic edit save account
- changes to AccountController - added postEditAccount - change postCreateAccount to use lambda - added success message to edit.html - added lambda to deal with password to toAccountRequest in Mapping.kt - added updateAccount to AccountRegistryService - added accountRegistryUpdate to WebClientCalls.kt - added NoChangeException - added NotFoundException
This commit is contained in:
@@ -10,6 +10,7 @@ import ltd.hlaeja.util.accountRegistryAccount
|
||||
import ltd.hlaeja.util.accountRegistryAccounts
|
||||
import ltd.hlaeja.util.accountRegistryAuthenticate
|
||||
import ltd.hlaeja.util.accountRegistryCreate
|
||||
import ltd.hlaeja.util.accountRegistryUpdate
|
||||
import org.springframework.http.HttpStatus.BAD_REQUEST
|
||||
import org.springframework.security.authentication.AuthenticationServiceException
|
||||
import org.springframework.security.core.AuthenticationException
|
||||
@@ -78,4 +79,15 @@ class AccountRegistryService(
|
||||
else -> Mono.error(ResponseStatusException(BAD_REQUEST, error.message))
|
||||
}
|
||||
}
|
||||
|
||||
fun updateAccount(
|
||||
account: UUID,
|
||||
request: Account.Request,
|
||||
): Mono<Account.Response> = webClient.accountRegistryUpdate(account, 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