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/#95] 채팅 관련 정보 조회 API 연결 #107

Merged
merged 22 commits into from
Jan 23, 2025
Merged

Conversation

jangsjw
Copy link
Contributor

@jangsjw jangsjw commented Jan 22, 2025

Related issue 🛠

Work Description ✏️

  • 채팅 관련 정보 조회 API

Screenshot 📸

  1. 팔아요
1.mp4

2, 구해요

2.mp4

To Reviewers 📢

채팅 관련 정보 조회 했습니다!

@jangsjw jangsjw added FEAT ✨ 새로운 기능 구현 모드레드재원 👿 재원 labels Jan 22, 2025
@jangsjw jangsjw self-assigned this Jan 22, 2025
Copy link

@yeonjeen yeonjeen left a comment

Choose a reason for hiding this comment

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

뭐죠 이 미친 성장속도...? 아주 짱짱입니다!!👍🏻 수고많으셨고 리뷰확인 부탁드려용:)

import javax.inject.Inject

class ChatDataSource @Inject constructor(
private val service: ChatService

Choose a reason for hiding this comment

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

p1: 트콤

Comment on lines 8 to 13
@SerialName("nickname") val nickname: String,
@SerialName("firstPhoto") val firstPhoto: String,
@SerialName("tradeType") val tradeType: String,
@SerialName("title") val title: String,
@SerialName("price") val price: Int,
@SerialName("isPriceNegotiable") val isPriceNegotiable: Boolean,

Choose a reason for hiding this comment

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

p1: 개행해주세요~

Suggested change
@SerialName("nickname") val nickname: String,
@SerialName("firstPhoto") val firstPhoto: String,
@SerialName("tradeType") val tradeType: String,
@SerialName("title") val title: String,
@SerialName("price") val price: Int,
@SerialName("isPriceNegotiable") val isPriceNegotiable: Boolean,
@SerialName("nickname")
val nickname: String,
@SerialName("firstPhoto")
val firstPhoto: String,
@SerialName("tradeType")
val tradeType: String,
@SerialName("title")
val title: String,
@SerialName("price")
val price: Int,
@SerialName("isPriceNegotiable")
val isPriceNegotiable: Boolean,

import javax.inject.Inject

class ChatRepositoryImpl @Inject constructor(
private val dataSource: ChatDataSource

Choose a reason for hiding this comment

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

p1: 트콤

tradeType = uiState.tradeType,
title = uiState.title,
firstPhoto = uiState.firstPhoto,
price = "${uiState.price.toString().formatToPriceString()}원",

Choose a reason for hiding this comment

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

p1: '원'도 스트링 추출 해주세여~

onNavigateUp: () -> Unit,
) {
composable<DetailPage> {
composable<DetailPage> { backStackEntry ->
val productId = backStackEntry.arguments?.getLong("productId") ?: 0L

Choose a reason for hiding this comment

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

p2: productId가 nullable한 이유가 뭔가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

productId가 없거나 잘못된 데이터를 전달한 경우에도 앱이 튕기면서 꺼지는 경우를 대비해서 넣었습니다! 오류나면서 꺼지는 것보다 기본값 나오는 게 나을 것 같아서 적용했는데 수정할까욤??

Copy link
Member

@boiledEgg-s boiledEgg-s left a comment

Choose a reason for hiding this comment

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

나날이 일취월장이네요! 장재원 멋지다

@Binds
@Singleton
abstract fun bindChatRepository(
impl: ChatRepositoryImpl,
Copy link
Member

Choose a reason for hiding this comment

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

p1: 이름 컨벤션 => chatRepositoryImpl

Comment on lines 13 to 19
val response = dataSource.getChatInfo(productId)
if (response.status == 200) {
response.data.toDomain()
} else {
throw IllegalStateException("Error fetching chat info: ${response.message}")
}
}
Copy link
Member

Choose a reason for hiding this comment

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

p1: 예전 리뷰에서도 언급한 적 있는 것 같은데, dataSource의 함수를 호출했을 때 오류가 발생하면 runCatching에서 자동으로 failure 처리를 합니다! 따라서 다음과 같이 수정해도 별탈 없이 코드가 수행됩니다

Suggested change
val response = dataSource.getChatInfo(productId)
if (response.status == 200) {
response.data.toDomain()
} else {
throw IllegalStateException("Error fetching chat info: ${response.message}")
}
}
val response = dataSource.getChatInfo(productId)
response.data.toDomain()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

아앗 맞네요!..

Copy link
Contributor

@jm991014 jm991014 left a comment

Choose a reason for hiding this comment

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

안드 짱!!! 부상투혼 고생 많으셨습니다 ㅋㅎㅋㅎㅋ

@jangsjw jangsjw merged commit 363a1a4 into develop Jan 23, 2025
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] 채팅 관련 정보 조회 API
4 participants