Skip to content

Commit

Permalink
�[edit #167] 회원 저장 로직 수정 (#168)
Browse files Browse the repository at this point in the history
* feat : User 도메인 email 필드 기본값 세팅

* edit : 회원 저장 시 email 저장 안하도록 수정

* fix : AuthService test 오류 수정

* edit : 이메일 기본값 변경
  • Loading branch information
dlswns2480 authored Sep 30, 2024
1 parent 3236df3 commit 4544326
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ class UserEntity(
val id: Long = 0L,

@Column(name = "email")
val email: String,
val email: String = "[email protected]",

@Column(name = "role")
@Enumerated(EnumType.STRING)
val role: Role,

@Column(name = "nickname")
var nickname: String = email,
var nickname: String = "NOT_REGISTERED",

@Column(name = "auth_platform")
@Enumerated(EnumType.STRING)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class AuthService(

private fun createUser(userInfo: UserInfo): User {
val user = User(
email = userInfo.email!!, // 존재하지 않았던 유저면 이메일 항상 존재
role = Role.USER,
authPlatform = userInfo.authPlatform,
sub = userInfo.sub
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AuthServiceTest : BehaviorSpec({

every { googleApiClient.getUserInfo(request.idToken) } returns userInfo
every {
userPort.loadByEmailAndAuthPlatform(userInfo.email, AuthPlatform.of(request.authPlatform))
userPort.loadByEmailAndAuthPlatform(userInfo.email!!, AuthPlatform.of(request.authPlatform))
} returns user
every { userPort.loadById(user.id) } returns user
every { tokenProvider.createToken(user.id) } returns token
Expand Down
4 changes: 2 additions & 2 deletions domain/src/main/kotlin/com/pokit/user/model/User.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import java.util.regex.Pattern

data class User(
val id: Long = 0L,
val email: String,
val email: String = "[email protected]",
val role: Role,
var nickName: String = email,
var nickName: String = "NOT_REGISTERED",
val authPlatform: AuthPlatform,
var registered: Boolean = false,
var sub: String?
Expand Down

0 comments on commit 4544326

Please sign in to comment.