-
Notifications
You must be signed in to change notification settings - Fork 0
fix: QA 수정사항 반영 #113
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
base: develop
Are you sure you want to change the base?
fix: QA 수정사항 반영 #113
Changes from all commits
6f00438
bcd27bc
7a28f91
f033342
bed4636
e5ff60c
0a23bc3
dffa147
80b9257
40cd83a
3ce4483
e91d2c2
76944d8
a8886ac
1bca665
a7b9f3a
af8f1a5
c511eb7
de3647c
450d33b
b96e2d9
3bfa6be
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,5 @@ | ||
| package com.kuit.findu.data.dataremote.exception | ||
|
|
||
| class ApiNotFoundException( | ||
| message: String, | ||
| ) : Exception(message) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package com.kuit.findu.data.dataremote.model.request | ||
|
|
||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class PostUserRequestDto( | ||
| @SerialName("nickname") | ||
| val nickname: String, | ||
| @SerialName("kakaoId") | ||
| val kakaoId: Long, | ||
| @SerialName("deviceId") | ||
| val deviceId: String, | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package com.kuit.findu.data.dataremote.model.request | ||
|
|
||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class TokenReissueRequestDto( | ||
| @SerialName("refreshToken") | ||
| val refreshToken: String, | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package com.kuit.findu.data.dataremote.model.response.auth | ||
|
|
||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class TokenReissueResponseDto( | ||
| @SerialName("accessToken") | ||
| val accessToken: String, | ||
| @SerialName("refreshToken") | ||
| val refreshToken: String, | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,43 +5,36 @@ import com.kuit.findu.data.dataremote.model.base.NullableBaseResponse | |
| import com.kuit.findu.data.dataremote.model.request.CheckNicknameRequestDto | ||
| import com.kuit.findu.data.dataremote.model.request.GuestLoginRequestDto | ||
| import com.kuit.findu.data.dataremote.model.request.LoginRequestDto | ||
| import com.kuit.findu.data.dataremote.model.request.PostUserRequestDto | ||
| import com.kuit.findu.data.dataremote.model.response.CheckNicknameResponseDto | ||
| import com.kuit.findu.data.dataremote.model.response.auth.GuestLoginResponseDto | ||
| import com.kuit.findu.data.dataremote.model.response.auth.LoginResponseDto | ||
| import com.kuit.findu.data.dataremote.model.response.auth.UserInfoDto | ||
| import com.kuit.findu.data.dataremote.util.ApiConstraints.API | ||
| import com.kuit.findu.data.dataremote.util.ApiConstraints.AUTH | ||
| import com.kuit.findu.data.dataremote.util.ApiConstraints.VERSION | ||
| import okhttp3.MultipartBody | ||
| import okhttp3.RequestBody | ||
| import retrofit2.http.Body | ||
| import retrofit2.http.Multipart | ||
| import retrofit2.http.POST | ||
| import retrofit2.http.Part | ||
|
|
||
| interface AuthService { | ||
| @POST("/$API/$VERSION/$AUTH/login/kakao") | ||
| suspend fun postLogin( | ||
| @Body loginRequestDto: LoginRequestDto | ||
| @Body loginRequestDto: LoginRequestDto, | ||
| ): NullableBaseResponse<LoginResponseDto> | ||
|
|
||
| @POST("/$API/$VERSION/$AUTH/login/guest") | ||
| suspend fun postGuestLogin( | ||
| @Body guestLoginRequestDto: GuestLoginRequestDto | ||
| @Body guestLoginRequestDto: GuestLoginRequestDto, | ||
| ): NullableBaseResponse<GuestLoginResponseDto> | ||
|
|
||
| @POST("/$API/$VERSION/users/check/duplicate-nickname") | ||
| suspend fun postCheckNickname( | ||
| @Body checkNicknameRequestDto: CheckNicknameRequestDto | ||
| @Body checkNicknameRequestDto: CheckNicknameRequestDto, | ||
| ): BaseResponse<CheckNicknameResponseDto> | ||
|
|
||
| @Multipart | ||
| @POST("/$API/$VERSION/users") | ||
| suspend fun postSignup( | ||
| @Part profileImage: MultipartBody.Part?, | ||
| @Part("defaultProfileImageName") defaultImageName: RequestBody?, | ||
| @Part("nickname") nickname: RequestBody, | ||
| @Part("kakaoId") kakaoId: RequestBody, | ||
| @Part("deviceId") deviceId: RequestBody | ||
| @Body postUserRequestDto: PostUserRequestDto, | ||
| ): NullableBaseResponse<UserInfoDto> | ||
|
Comment on lines
36
to
39
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. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Find PostUserRequestDto.kt
fd -t f "PostUserRequestDto.kt" -x cat {}Repository: FindYou-Kuit/FindYou-Android Length of output: 200 🏁 Script executed: #!/bin/bash
# Check postSignup usage and AuthRemoteDataSourceImpl
rg -n -A 5 "postSignup" --type kotlinRepository: FindYou-Kuit/FindYou-Android Length of output: 7469 🏁 Script executed: #!/bin/bash
# Check AuthService.kt to see the current state
fd -t f "AuthService.kt" -x head -50 {}Repository: FindYou-Kuit/FindYou-Android Length of output: 1864 🏁 Script executed: #!/bin/bash
# Find and examine PostUserRequestDto
fd -t f "PostUserRequestDto.kt" -x cat {}Repository: FindYou-Kuit/FindYou-Android Length of output: 413 🏁 Script executed: #!/bin/bash
# Check if profile image is handled elsewhere in signup flow
rg -n "profileImage|profileImageFile" --type kotlin -iRepository: FindYou-Kuit/FindYou-Android Length of output: 11794 회원가입 API JSON 형식 변경 깔끔하게 처리됨 Multipart에서 JSON Body로 변경된 부분이 잘 정리되어 있습니다. PostUserRequestDto는 nickname, kakaoId, deviceId만 담고 있으며, AuthService.postSignup에서 @Body로 깔끔하게 처리되고 있네요. 다만 한 가지 주의할 점이 있습니다: PostSignupUseCase → AuthRepository → AuthRepositoryImpl → AuthRemoteDataSource → AuthRemoteDataSourceImpl으로 이어지는 체인 전체에서 profileImageFile과 defaultImageName 파라미터가 계속 전달되고 있지만, 실제로는 AuthRemoteDataSourceImpl에서 이들을 사용하지 않고 있습니다. 프로필 이미지는 회원가입 후 PatchProfileImageUseCase를 통해 별도로 처리되고 있으므로, 불필요한 파라미터들은 정리하는 것을 고려해보세요. 🤖 Prompt for AI Agents |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package com.kuit.findu.data.dataremote.service | ||
|
|
||
| import com.kuit.findu.data.dataremote.model.base.BaseResponse | ||
| import com.kuit.findu.data.dataremote.model.request.TokenReissueRequestDto | ||
| import com.kuit.findu.data.dataremote.model.response.auth.TokenReissueResponseDto | ||
| import com.kuit.findu.data.dataremote.util.ApiConstraints.API | ||
| import com.kuit.findu.data.dataremote.util.ApiConstraints.AUTH | ||
| import com.kuit.findu.data.dataremote.util.ApiConstraints.VERSION | ||
| import retrofit2.http.Body | ||
| import retrofit2.http.POST | ||
|
|
||
| interface ReissueService { | ||
|
|
||
| @POST("/$API/$VERSION/$AUTH/reissue/token") | ||
| suspend fun postReissueToken( | ||
| @Body tokenReissueRequestDto: TokenReissueRequestDto, | ||
| ): BaseResponse<TokenReissueResponseDto> | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,34 +1,53 @@ | ||
| package com.kuit.findu.data.dataremote.util | ||
|
|
||
| import android.content.Context | ||
| import android.content.Intent | ||
| import com.kuit.findu.data.datalocal.datasource.TokenLocalDataSource | ||
| import com.kuit.findu.presentation.ui.login.LoginActivity | ||
| import dagger.hilt.android.qualifiers.ApplicationContext | ||
| import okhttp3.Interceptor | ||
| import com.kuit.findu.data.dataremote.model.request.TokenReissueRequestDto | ||
| import com.kuit.findu.data.dataremote.service.ReissueService | ||
| import kotlinx.coroutines.runBlocking | ||
| import okhttp3.Authenticator | ||
| import okhttp3.Request | ||
| import okhttp3.Response | ||
| import okhttp3.Route | ||
| import javax.inject.Inject | ||
|
|
||
| class AuthAuthenticator @Inject constructor( | ||
| private val tokenLocalDataSource: TokenLocalDataSource, | ||
| @ApplicationContext private val context: Context | ||
| ) : Interceptor { | ||
| override fun intercept(chain: Interceptor.Chain): Response { | ||
| val request = chain.request() | ||
| val response = chain.proceed(request) | ||
|
|
||
| private val reissueService: ReissueService, | ||
| ) : Authenticator { | ||
| override fun authenticate(route: Route?, response: Response): Request? { | ||
| // 401 Unauthorized 에러 감지 | ||
| if (response.code == 401) { | ||
| // 토큰 삭제 | ||
| tokenLocalDataSource.clearToken() | ||
| return try { | ||
| val refreshToken = tokenLocalDataSource.refreshToken | ||
|
|
||
| // 토큰 재발급 요청 | ||
| val reissueResponse = runBlocking { | ||
| reissueService.postReissueToken( | ||
| TokenReissueRequestDto(refreshToken) | ||
| ) | ||
| } | ||
|
|
||
| if (reissueResponse.success) { | ||
| // 새로운 토큰으로 저장 | ||
| tokenLocalDataSource.accessToken = reissueResponse.data.accessToken | ||
| tokenLocalDataSource.refreshToken = reissueResponse.data.refreshToken | ||
|
|
||
| // 로그인 화면으로 이동 | ||
| val intent = Intent(context, LoginActivity::class.java).apply { | ||
| flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK | ||
| // 새로운 토큰으로 원래 요청 재시도 | ||
| response.request.newBuilder() | ||
| .header("Authorization", "Bearer ${reissueResponse.data.accessToken}") | ||
| .build() | ||
| } else { | ||
| // 토큰 재발급 실패 - 로그인 화면으로 이동 | ||
| tokenLocalDataSource.clearToken() | ||
| null | ||
| } | ||
| } catch (e: Exception) { | ||
| // 토큰 재발급 중 오류 발생 - 로그인 화면으로 이동 | ||
| tokenLocalDataSource.clearToken() | ||
| null | ||
| } | ||
| context.startActivity(intent) | ||
| } | ||
|
|
||
| return response | ||
| return null | ||
| } | ||
| } |
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.
사용되지 않는 import 제거 필요
@Multipart어노테이션 import가 더 이상 사용되지 않습니다.postSignup이@Body로 변경되면서 불필요해졌네요.🧹 수정 제안
-import retrofit2.http.Multipart📝 Committable suggestion
🤖 Prompt for AI Agents