-
Notifications
You must be signed in to change notification settings - Fork 1
[DPMBE-55] feat : 회원가입,로그인 및 fcm 토큰 업데이트 기능 추가 #76
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
Conversation
|
||
fun user_id_1_fixture(): User { | ||
return User( | ||
oauthInfo_kakao_1_fixture(), | ||
"유저1", | ||
"url1", | ||
true, | ||
fcmNotificationVo_fixture(), | ||
LocalDateTime.now(), | ||
UserStatus.NORMAL, | ||
AccountRole.USER, | ||
1, | ||
) | ||
} | ||
|
||
fun oauthInfo_kakao_1_fixture(): OauthInfo { | ||
return OauthInfo("1", OauthProvider.KAKAO) | ||
} | ||
|
||
fun fcmNotificationVo_fixture(): FcmNotificationVo { | ||
return FcmNotificationVo("fcmToken", true) | ||
} |
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.
제꺼 테스트에도 이런식으로 적어놓긴 했는데 이거 보고 조금 수정해야겠네요
Kudos, SonarCloud Quality Gate passed! |
package com.depromeet.whatnow.api.user.dto.request | ||
|
||
data class UpdateFcmTokenRequest( | ||
val fcmToken: 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.
@Valid 넣어주셨는데 나중에 fcm Constraint 생기면 어노테이션으로 추가하면 되겠네요 (참고 )
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.
예압
} | ||
|
||
fun updateFcmToken(updateTokenRequest: UpdateFcmTokenRequest): User { | ||
val currentUserId: Long = SecurityUtils.currentUserId |
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.
다시봐도 이거 진짜 개꿀임..
@@ -14,4 +15,12 @@ class UserAdapter( | |||
fun queryUser(userId: Long): User { | |||
return userRepository.findByIdOrNull(userId) ?: run { throw UserNotFoundException.EXCEPTION } | |||
} | |||
|
|||
fun queryByOauthInfo(oauthInfo: OauthInfo): User { | |||
return userRepository.findByOauthInfo(oauthInfo) ?: run { throw UserNotFoundException.EXCEPTION } |
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.
여기도 runCatching 하면 좋지 않을까요? 우리 컨벤션 이야기 해보면 좋을 것 같아요
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.
runCatching 은 한번 감싸는 용도로 쓸 때만 적음 좋을것같아요
Adapter의 경우
query 가 NotFound 오류 디폴트로 하기로 했으니 이대로가고
그 쿼리메서드에 관련한 에러처리를 result로 래핑해서 전략을 짜는 책임은
도메인 서비스에 있다고 봐유!
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.
LGTM
* feat : fcmvo * feat : register fcmtoken appalram add * refactor : refresh , login 메소드 분리 * feat : toggle AppAlarm * feat : fcm token 업데이트 기능 추가 * feat : query By result 로 리팩토링 * style : spotless * test : result 회원가입 래핑 테스트 추가 * refactor : readUserusecase query user 사용
개요
작업사항
변경로직
Kotlin Result 관련
위처럼 2가지 결과값은 같은데 에러처리를 할 때 대응할 때 달라져서 그냥
repository 에서 받아오고 있었는데
이거 없애고 싶어서
userAdapter 에
위에걸 기본으로 대고
위처럼 userDomain 서비스에서 한 번 Kotlin Result 로 래핑해서 쓰기로 했더니
좀 더 깔끔해졌어요 소스가 ㅎㅎ