Skip to content

Commit

Permalink
Push works
Browse files Browse the repository at this point in the history
  • Loading branch information
cheroliv committed Sep 28, 2024
1 parent d38486b commit 7441f0b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion springboot/api/src/main/kotlin/webapp/users/User.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ abstract class EntityModel<T>(
inline fun <reified T : EntityModel<ID>, ID> T.withId(id: ID): T {
// Use reflection to create a copy with the passed ID
return this::class.constructors
.first { it.parameters.any { param -> param.name == "id" || param.name == "role"} }
.first { it.parameters.any { param -> param.name == "id"} }
.call(id, *this::class.constructors.first().parameters.drop(1).map { param ->
this::class.members.first { member -> member.name == param.name }.call(this)
}.toTypedArray())
Expand Down
5 changes: 3 additions & 2 deletions springboot/api/src/main/kotlin/webapp/users/security/Role.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import jakarta.validation.constraints.Size
import webapp.core.property.ROLE_ADMIN
import webapp.core.property.ROLE_ANONYMOUS
import webapp.core.property.ROLE_USER
import webapp.users.EntityModel
import webapp.users.security.Role.RoleDao.Fields.ID_FIELD

data class Role(
@field:NotNull
@field:Size(max = 50)
val role: String
) {
override val id: String
):EntityModel<String>() {
object RoleDao {
object Fields {
const val ID_FIELD = "`role`"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class SignupIntegrationTests {
// assertEquals(0, countUserAuthBefore)
client
.post()
.uri(API_SIGNUP_PATH)
.uri("/api/users/foobar")
.contentType(APPLICATION_JSON)
.bodyValue(user)
.exchange()
Expand All @@ -114,7 +114,7 @@ class SignupIntegrationTests {
// assertEquals(countUserAuthBefore + 1, context.countUserAuthority())
(user to context).findOneByEmail(user.email).run {
when (this) {
is Left -> assertEquals(EmptyResultDataAccessException::class.java,value::class.java )
is Left -> assertEquals(EmptyResultDataAccessException::class.java, value::class.java)
is Right -> {
assertEquals(user, value)
}
Expand Down

0 comments on commit 7441f0b

Please sign in to comment.