Get Account
- add AccountController - add AccountEntity toAccountResponse in Mapping.kt - add AccountService - add AccountRepository - add AccountEntity
This commit is contained in:
15
src/main/kotlin/ltd/hlaeja/util/Mapping.kt
Normal file
15
src/main/kotlin/ltd/hlaeja/util/Mapping.kt
Normal file
@@ -0,0 +1,15 @@
|
||||
package ltd.hlaeja.util
|
||||
|
||||
import ltd.hlaeja.entity.AccountEntity
|
||||
import ltd.hlaeja.library.accountRegistry.Account
|
||||
import org.springframework.http.HttpStatus.EXPECTATION_FAILED
|
||||
import org.springframework.web.server.ResponseStatusException
|
||||
|
||||
fun AccountEntity.toAccountResponse(): Account.Response = Account.Response(
|
||||
id ?: throw ResponseStatusException(EXPECTATION_FAILED),
|
||||
updatedAt,
|
||||
enabled,
|
||||
username,
|
||||
roles.split(","),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user