-
Notifications
You must be signed in to change notification settings - Fork 2
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
[FEAT/#77] 초대 코드 검증 API #82
Conversation
…into feat/#77-enter-trip-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.
조세연님의 첫 서버통신 완료를 경축드립니다.
|
||
interface EnterTripDataSource { | ||
suspend fun postEnterTrip( | ||
code: EnterTripRequestDto, |
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.
code 라고 값만 작성하시면, 서비스에서 서버통신을 진행할 때 requestDto가 아니라 Path나 Query같은 파라미터 값으로 혼동될 수 있기 때문에 파라미터 값을 이왕이면 request로 작성하는 것이 더 좋을 듯 합니다
interface EnterTripService { | ||
@POST("/api/trips/verify") | ||
suspend fun postEnterTrip( | ||
@Body body: EnterTripRequestDto, |
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.
여기도 통일성을 위해서 request로 갑시당 ~
|
||
override suspend fun postEnterTrip( | ||
requestEnterTripModel: RequestEnterTripModel | ||
): Result<EnterTripModel?> = |
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.
? 없애도 돌릴 수 있을 것 같아요 ~
data class RequestEnterTripModel( | ||
val code: 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.
진짜 사소할 수 있는 네이밍 통일인데, ~RequestModel, ~Model, ~RequestDto, ~ResponseDto 로 갑시다 !
suspend fun postEnterTrip( | ||
requestEnterTripModel: RequestEnterTripModel | ||
): Result<EnterTripModel?> |
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.
여기도 같이 ? 빼주세요 ~
putExtra("title", state.data.title) | ||
putExtra("start", state.data.startDate) | ||
putExtra("end", state.data.endDate) | ||
putExtra("day", state.data.day) |
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.
엑스트라를 인텐트로 옮기는 과정에서는 키값을 한 곳에서 보관해주시는 것이 좋습니다!
이럴 때는 받는 곳이나 보내는 곳중에 엑스트라를 더 많이 사용할 것 같은 뷰에서 const val로 따로 텍스트를 지정해주시는 것이 좋습니다
예시 :
companion object {
const val EXTRA_TODO_ID = "EXTRA_TODO_ID"
}
) : ViewModel() { | ||
private val _tripState = MutableStateFlow<UiState<EnterTripModel>>(UiState.Empty) |
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.
줄바꿈하면 예쁠듯 ㅋㅋ
enterTripRepository.postEnterTrip( | ||
RequestEnterTripModel(inviteCode.value ?: "") | ||
).onSuccess { result -> | ||
_tripState.value = result?.let { UiState.Success(it) } ?: UiState.Failure("no") |
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.
앞에 애들에서 ?를 제외해서 보내게 된다면, 뷰모델에서 null값에 대해서 예외처리를 진행하지 않고도 편하게 사용 가능합니다~
@@ -2,28 +2,49 @@ package com.going.presentation.enter.invitefinish | |||
|
|||
import android.content.Intent | |||
import android.os.Bundle | |||
import androidx.activity.viewModels | |||
import android.util.Log |
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.
ㅋㅋ
binding.tvInviteFinishName.text = title | ||
binding.tvInviteFinishDay.text = "$start - $end" | ||
|
||
|
||
if (day > 0) { | ||
binding.tvInviteFinishDayLeft.text = "D - $day" | ||
} else binding.tvInviteFinishDayLeft.text = "여행중" |
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.
중복되는 바인딩에는 스코프 함수 쓰면 좋을 듯 합니다
텍스트 추출도 같이 진행해주세요 ~
(if 한쪽만 괄호쳐져있는거 살짝 킹받음 ㅋㅋ)
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.
첫 서버통신 연결 축하드립니다!!!!
코드 너무 좋네용~
binding.tvInviteFinishDay.text = "$start - $end" | ||
|
||
|
||
if (day > 0) { | ||
binding.tvInviteFinishDayLeft.text = "D - $day" |
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.
이후 수정의 용이성을 위해서 "%1d - %2d" 와 같이 변수를 포함한 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.
공백...ㅎㅎㅎ
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.
첫 서버 통신 너무너무 수고하셨습니다!! 남은 API도 홧팅
val end = intent.getStringExtra("end") | ||
val day = intent.getIntExtra("day", 0) | ||
Log.d("day", day.toString()) |
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.
int 값은 이렇게 받을 수 있군요!
android:maxLines="2" | ||
android:text="2023.03.24 - 2023.03.31" | ||
tools:text="2023.03.24 - 2023.03.31" |
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.
날짜 값을 하나로 묶었군여,, 저도 이렇게 해봐야겠어용
⛳️ Work Description
📸 Screenshot
Screen_Recording_20240112_092832_doorip.mp4
📢 To Reviewers