update create and edit account role mapping

This commit is contained in:
2025-08-18 11:38:41 +02:00
committed by swordsteel
parent f1d0e90bde
commit 879cd402ad

View File

@@ -16,17 +16,13 @@ fun AccountForm.toAccountRequest(): Account.Request = Account.Request(
username = username,
password = if (password.isNullOrEmpty()) null else password,
enabled = enabled,
roles = roles.map { "ROLE_${it.uppercase()}" },
roles = roles.map { it.uppercase() },
)
fun Account.Response.toAccountForm(): AccountForm = AccountForm(
username = username,
enabled = enabled,
roles = roles.map {
it.removePrefix("ROLE_")
.lowercase()
.replaceFirstChar { char -> char.uppercase() }
},
roles = roles.map { it.lowercase().replaceFirstChar { char -> char.uppercase() } },
)
fun TypeForm.toTypeRequest(): Type.Request = Type.Request(