-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DRAW-427 유저 상세 정보 조회 #14
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package com.xorker.draw.user | ||
|
||
import com.xorker.draw.auth.AuthInfo | ||
import com.xorker.draw.auth.AuthPlatform | ||
import com.xorker.draw.auth.AuthUserJpaEntity | ||
import com.xorker.draw.auth.AuthUserJpaRepository | ||
|
@@ -19,6 +20,10 @@ internal class UserAdapter( | |
override fun getUser(userId: UserId): UserInfo? = | ||
userJpaRepository.findByIdOrNull(userId.value)?.toDomain() | ||
|
||
override fun getAuthInfo(userId: UserId): AuthInfo? { | ||
return authUserJpaRepository.findByUserId(userId.value)?.toDomain() | ||
} | ||
|
||
override fun createUser(platform: AuthPlatform, platformUserId: String, userName: String): UserInfo { | ||
val user = UserJpaEntity() | ||
val authUser = authUserJpaRepository.save(AuthUserJpaEntity.of(platform, platformUserId, user)) | ||
|
@@ -45,4 +50,9 @@ internal class UserAdapter( | |
user.name = nickname | ||
return userJpaRepository.save(user).toUser() | ||
} | ||
|
||
private fun AuthUserJpaEntity.toDomain(): AuthInfo = AuthInfo( | ||
this.platform, | ||
"[email protected]", // TODO | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
app/api/src/main/kotlin/com/xorker/draw/user/dto/UserDetailResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.xorker.draw.user.dto | ||
|
||
import com.xorker.draw.auth.AuthPlatform | ||
import com.xorker.draw.user.UserDetail | ||
import com.xorker.draw.user.UserId | ||
import io.swagger.v3.oas.annotations.media.Schema | ||
|
||
data class UserDetailResponse( | ||
val id: UserId, | ||
val nickname: String?, | ||
|
||
@Schema(description = "null 일 경우 게스트") | ||
val authPlatform: AuthPlatform?, | ||
val email: String?, | ||
) | ||
|
||
fun UserDetail.toResponse(): UserDetailResponse = UserDetailResponse( | ||
id = this.id, | ||
nickname = this.name, | ||
authPlatform = this.authPlatform, | ||
email = this.email, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package com.xorker.draw.user | ||
|
||
interface UserUseCase { | ||
fun getUserDetail(userId: UserId): UserDetail | ||
|
||
fun updateUser(userId: UserId, nickname: String): User | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.xorker.draw.auth | ||
|
||
data class AuthInfo( | ||
val authPlatform: AuthPlatform, | ||
val email: String, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
domain/src/main/kotlin/com/xorker/draw/user/UserRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P5
userId는 로그인 api에서 일괄적으로 내려주게 되는데, 유저 상세 조회 응답으로 넣은 이유를 알 수 있을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SunwoongH
API 흐름 보다는 API 자체의 역할에 집중했다고 할까요?