Skip to content
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

Merged
merged 13 commits into from
Jan 12, 2024
Merged

Conversation

crownjoe
Copy link
Contributor

⛳️ Work Description

  • 초대코드 검증 서버통신 구현 완료

📸 Screenshot

Screen_Recording_20240112_092832_doorip.mp4

📢 To Reviewers

  • 행복하자 과자파티 하자

Copy link
Member

@Marchbreeze Marchbreeze left a 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,
Copy link
Member

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,
Copy link
Member

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?> =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? 없애도 돌릴 수 있을 것 같아요 ~

Comment on lines 3 to 5
data class RequestEnterTripModel(
val code: String
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

진짜 사소할 수 있는 네이밍 통일인데, ~RequestModel, ~Model, ~RequestDto, ~ResponseDto 로 갑시다 !

Comment on lines 8 to 10
suspend fun postEnterTrip(
requestEnterTripModel: RequestEnterTripModel
): Result<EnterTripModel?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기도 같이 ? 빼주세요 ~

Comment on lines 96 to 99
putExtra("title", state.data.title)
putExtra("start", state.data.startDate)
putExtra("end", state.data.endDate)
putExtra("day", state.data.day)
Copy link
Member

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"
}

Comment on lines 21 to 22
) : ViewModel() {
private val _tripState = MutableStateFlow<UiState<EnterTripModel>>(UiState.Empty)
Copy link
Member

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")
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ㅋㅋ

Comment on lines 38 to 44
binding.tvInviteFinishName.text = title
binding.tvInviteFinishDay.text = "$start - $end"


if (day > 0) {
binding.tvInviteFinishDayLeft.text = "D - $day"
} else binding.tvInviteFinishDayLeft.text = "여행중"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

중복되는 바인딩에는 스코프 함수 쓰면 좋을 듯 합니다
텍스트 추출도 같이 진행해주세요 ~
(if 한쪽만 괄호쳐져있는거 살짝 킹받음 ㅋㅋ)

@Marchbreeze Marchbreeze changed the title [Feat/#77] 초대 코드 검증 API [FEAT/#77] 초대 코드 검증 API Jan 12, 2024
Copy link
Member

@chattymin chattymin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

첫 서버통신 연결 축하드립니다!!!!
코드 너무 좋네용~

Comment on lines 39 to 43
binding.tvInviteFinishDay.text = "$start - $end"


if (day > 0) {
binding.tvInviteFinishDayLeft.text = "D - $day"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이후 수정의 용이성을 위해서 "%1d - %2d" 와 같이 변수를 포함한 string값으로 추출해서 적용하면 더욱 좋을 것 같네용~

Comment on lines 17 to 19


}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

공백...ㅎㅎㅎ

Copy link
Member

@leeeyubin leeeyubin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

첫 서버 통신 너무너무 수고하셨습니다!! 남은 API도 홧팅

Comment on lines 34 to 36
val end = intent.getStringExtra("end")
val day = intent.getIntExtra("day", 0)
Log.d("day", day.toString())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int 값은 이렇게 받을 수 있군요!

Comment on lines 103 to +104
android:maxLines="2"
android:text="2023.03.24 - 2023.03.31"
tools:text="2023.03.24 - 2023.03.31"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

날짜 값을 하나로 묶었군여,, 저도 이렇게 해봐야겠어용

@crownjoe crownjoe merged commit dd0ae45 into develop Jan 12, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FEAT ✨ 새로운 기능 구현 세연 🤤
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT] 초대 코드 여행 입장 뷰/ 서버통신 구현
4 participants