Add insertUser into repo

This commit is contained in:
2019-08-23 12:19:09 +02:00
parent 0108d496e0
commit 46885ac599

View File

@@ -26,6 +26,12 @@ class User(override var requester: Requester) : RepositoryI<UserEntity> {
) ?: throw UserNotFound(id) ) ?: throw UserNotFound(id)
} }
fun insert(user: UserEntity): UserEntity? {
return requester
.getFunction("insert_user")
.selectOne("resource" to user)
}
class UserNotFound(override val message: String?, override val cause: Throwable?): Throwable(message, cause) { class UserNotFound(override val message: String?, override val cause: Throwable?): Throwable(message, cause) {
constructor(id: UUID): this("No User with ID $id", null) constructor(id: UUID): this("No User with ID $id", null)
} }