-
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
[feature/19] 프로필 조회 구현 #22
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.nexters.bottles.user.facade.dto | ||
|
||
import com.nexters.bottles.user.domain.QuestionAndAnswer | ||
import com.nexters.bottles.user.domain.UserProfileSelect | ||
|
||
data class UserProfileResponseDto( | ||
val userName: String, | ||
val age: Int, | ||
val introduction: List<QuestionAndAnswer>? = null, | ||
val profileSelect: UserProfileSelect? = null, | ||
) { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ import com.nexters.bottles.user.repository.UserRepository | |
import mu.KotlinLogging | ||
import org.springframework.data.repository.findByIdOrNull | ||
import org.springframework.stereotype.Service | ||
import javax.transaction.Transactional | ||
import org.springframework.transaction.annotation.Transactional | ||
|
||
@Service | ||
class UserProfileService( | ||
|
@@ -26,7 +26,6 @@ class UserProfileService( | |
profileRepository.findByUserId(user.id)?.let { | ||
it.user = user | ||
it.profileSelect = profileSelect | ||
it.introduction = it.introduction | ||
} ?: run { | ||
profileRepository.save( | ||
UserProfile( | ||
|
@@ -53,4 +52,9 @@ class UserProfileService( | |
) | ||
} | ||
} | ||
|
||
@Transactional(readOnly = true) | ||
fun findUserProfile(userId: Long): UserProfile? { | ||
return profileRepository.findByUserId(userId) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 오 저도 오랜만에 해서 까먹었었는데 생각해보니까 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아하 그쵸 맞아요 그랬던 기억이 쪼끔나서 여쭤봤었어요 ㅋㅋ |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.nexters.bottles.user.service | ||
|
||
import com.nexters.bottles.user.domain.User | ||
import com.nexters.bottles.user.repository.UserRepository | ||
import org.springframework.stereotype.Service | ||
import org.springframework.transaction.annotation.Transactional | ||
|
||
@Service | ||
class UserService( | ||
private val userRepository: UserRepository, | ||
) { | ||
} |
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.
생년월일을 저장하고 나이가 필요하면 계산해서 줘야겠네요
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.
이거 카카오에서 주는 정보가 생년월일 밖에 없어서 그런건가요??
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.
앗 아뇨! 나이를 저장하면 두 가지 문제가 있을거 같아요.
그래서 생년월일을 저장하는게 훨씬 유리할거 같아요!