Skip to content

Commit

Permalink
fix(users): added email field in controller that was unused
Browse files Browse the repository at this point in the history
  • Loading branch information
alemazzo authored and Ro0t-set committed May 20, 2024
1 parent 38a95eb commit 3d1f6f7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,24 @@ import piperkt.services.users.domain.user.Username
object UserEntityMapper {
/** Convert a user entity to a user. */
fun UserEntity.toDomain() =
User(Username(username), password, email, description, profilePicture, refreshToken)
User(
username = Username(username),
password = password,
email = email,
description = description,
profilePicture = profilePicture,
refreshToken = refreshToken
)

/** Convert a user to a user entity. */
fun User.toEntity() =
UserEntity(
id = null,
username.value,
password,
email,
description,
profilePicture,
refreshToken
username = username.value,
password = password,
email = email,
description = description,
profilePicture = profilePicture,
refreshToken = refreshToken
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class RegisterController(private val authService: AuthService) : RegisterApi {
.register(
request.username,
request.password,
request.email,
request.description,
request.profilePicture
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ class RegisterControllerTest(
afterEach { authService.delete(user.username.value) }

test("register") {
val response = authClient.register(RegisterApi.RegisterRequest("newuser", "password"))
val response =
authClient.register(
RegisterApi.RegisterRequest("newuser", "password", "email", "description")
)
response.username shouldBe "newuser"
response.description shouldBe null
response.description shouldBe "description"
response.email shouldBe "email"
response.profilePicture shouldBe null
authService.delete("newuser")
}
Expand Down

0 comments on commit 3d1f6f7

Please sign in to comment.