-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
fun userStatusFlow(userStatusListener: UserStatusListener) = integrationFlow { | ||
channel { publishSubscribe(Channels.USER_STATUS) } | ||
handle<UserStatusChangedEvent> { event, _ -> | ||
when (event.user.status) { |
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.
상관 없을 것 같아요
"spring.mail.username=***@gmail.com", | ||
"spring.mail.password=***", |
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.
발송 테스트용인데, 필요하시면 실제계정 입력해서 사용하시면 됩니다
@NotEmpty | ||
@Size(min = 8, max = 30, message = "비밀번호는 8자 이상 30자 미만이어야 합니다.") | ||
@Pattern(regexp = "(?=.*[A-z])(?=.*[0-9])", message = "비밀번호는 영문자와 숫자가 포함되어야 합니다.") | ||
val password: String, |
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.
user가입에 관한 validation은 request단에 뒀습니다
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.
엄청 많네요;; 아직 다 보진 못했는데 여태까지 본거 코멘트드립니다
override fun save(authCode: AuthCode): AuthCode { | ||
jdbcTemplate.update( | ||
""" | ||
REPLACE INTO auth_code (user_id, `code`, created_at, purpose) |
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.
코드가 더 길어지긴 하지만
replace 보단 on duplicate update 가 맞긴 하겠네요
(찾아보니 replace 는 기존 row 삭제 후 insert 를 다시 한다네요)
외부에 안나가니까 이대로 둬도 괜찮긴 합니다
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.
추가로 replace 때마다 created_at 이 엎어쳐지는게 조금 이상하네요
삭제되는건 아직 구현되기 전인가요?
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.
인증코드 일회성이라 인증하고 바로삭제하면 되겠네요!
created_at 덮어쓰는건, 인증 제한시간?정도 제약들어가면 사용될값으로 봤어요 (지금은 따로 없습니다)
최초 created_at 히스토리가 필요없어서, deleted-insert 의도된부분 맞습니다!
@@ -0,0 +1,15 @@ | |||
package com.sns.commons.utils |
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.
utils 아래 파일명은 Booleans
와 같이 클래스s 가 나을 것 같습니다
import com.sns.user.component.authcode.domain.Purpose | ||
import org.springframework.data.repository.NoRepositoryBean | ||
|
||
@NoRepositoryBean |
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.
다른데서 이거 붙이고 있는건 CrudRepository<T, ID>
를 상속하고 있어서고 (이거 붙은건 spring data 에서 bean 등록해버려서)
여기는 붙이지 않으셔도 될거에요
import org.springframework.data.annotation.Id | ||
import org.springframework.jdbc.core.RowMapper | ||
|
||
data class AuthCode( |
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.
지금 이 상태면 CrudRepository 의 장점을 거의 사용하지 못하는데
composite key 로 가지 않고 별도 long 아이디로 가는 것도 괜찮을 것 같습니다 (아이디를 사용할 일이 없지만)
이건 unique key 로 등록해두고요
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.
고민했던 부분이긴한데, save도 upsert처럼 동작해야하고, select도 uniqueKey로 만 하면 되는거라 crudRepository 있어도 활용을 잘 안할것같아서 crudRrepo빼고 쿼리 작성으로 구현한 부분이긴 합니다! (인증코드에서 현재 기능 이상의 스펙이 요구될 것 같지 않구요..?)
) { | ||
|
||
fun isCorrect(userId: String, code: String, purpose: Purpose): Boolean = | ||
(this.userId == userId) and (this.code == code) and (this.purpose == purpose) |
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.
오 and 가 있는건 몰랐네요
WHERE user_id = :userId AND purpose = :purpose | ||
LIMIT 1 | ||
""".trimIndent(), | ||
mutableMapOf( |
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.
여기는 mutable 이어야하나요?
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.
파라미터로 mutable 받고있어서 컴파일에러났던것같아요!
@@ -10,4 +10,6 @@ class UserQueryService( | |||
private val userRepository: UserRepository | |||
) { | |||
fun getById(id: String): User? = userRepository.findByIdOrNull(id) | |||
|
|||
fun getByEmail(email: String): User? = userRepository.findByInfoEmailAddressOrNull(email) |
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.
https://github.com/juniors-dev-study/domain-driven-design/pull/37/files#diff-9964b16bb728d71d6966d332a5c97ad9b5efa757538b2671c591d2bd1e46750eR8
https://github.com/juniors-dev-study/domain-driven-design/pull/37/files#diff-822de4fde5fd3db746695a31922cebd3a54e185e3a350ccf694ea61409acbb60R15
이거 CrudRepository 에서 쿼리 자동 생성해주는 기능 사용해서 이런 식으로 가능합니다
fun userStatusFlow(userStatusListener: UserStatusListener) = integrationFlow { | ||
channel { publishSubscribe(Channels.USER_STATUS) } | ||
handle<UserStatusChangedEvent> { event, _ -> | ||
when (event.user.status) { |
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.
상관 없을 것 같아요
|
||
override fun configure(http: HttpSecurity?) { | ||
if (http == null) return | ||
http.authorizeRequests() |
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.
코멘트 드린게 많아서 ㅋㅋ 나중에 시간되시면 재미로 한 번 봐주세요
https://www.baeldung.com/kotlin/spring-security-dsl
user-api/src/main/kotlin/com/sns/user/core/config/SwaggerTag.kt
Outdated
Show resolved
Hide resolved
Co-authored-by: Chanhyeong Cho <[email protected]>
- response는 json으로 - crudRepository 활용 - controller에 함께 aggregator 위치. (1:1 매칭)
진행상황
가입 시나리오
@IsLoginUser
먼저 사용하시면 될것같아요user가 profile. freinds를 가지는게 맞을까,, profile이 user를 가지는게 맞을까??
논의필요
200 + response body
식 혹은응답코드 적절하게 활용
방식 중 어떤게 나을지??json으로 무조건 묶는다
혹은간단한 응답은(Boolean?) 내용만 내린다