-
Notifications
You must be signed in to change notification settings - Fork 0
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/#120] 게시물 떠먹기 API 연결 #123
Merged
Merged
Changes from 9 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
638a4be
[FEAT/#120] 게시물 떠먹기 API 연결
Roel4990 11bb946
Merge remote-tracking branch 'origin/develop' into feat/#120-scoop-po…
Roel4990 fc1eeeb
[FEAT/#120] BaseResponseDTO -> BaseResponse 로 수정
Roel4990 3a3ff75
[FEAT/#120] PostService companion object 제거
Roel4990 9d83e47
[FEAT/#120] useSpoon param 수정 및 PostScoopRequestDTO -> PostScoopReque…
Roel4990 b1bced3
Merge remote-tracking branch 'origin/develop' into feat/#120-scoop-po…
Roel4990 b355bfc
[FEAT/#120] 코드리뷰 수정사항 수정
Roel4990 6075332
[FEAT/#120] 코드리뷰 수정사항 수정
Roel4990 4f54f84
Merge remote-tracking branch 'origin/develop' into feat/#120-scoop-po…
Roel4990 bf12e51
[FEAT/#120]
Roel4990 37e98aa
[FEAT/#120] ktLintFormat 처리
Roel4990 22acdff
Merge remote-tracking branch 'origin/develop' into feat/#120-scoop-po…
Roel4990 372c8ba
Merge remote-tracking branch 'origin/develop' into feat/#120-scoop-po…
Roel4990 2463c9c
[FEAT/#120] 잘못된 toImmutableList 임포트 수정
Roel4990 a392a7b
[FEAT/#120] List -> ImmutableList 로 수정
Roel4990 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
app/src/main/java/com/spoony/spoony/data/dto/request/PostScoopRequestDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.spoony.spoony.data.dto.request | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class PostScoopRequestDto( | ||
@SerialName("postId") | ||
val postId: Int, | ||
@SerialName("userId") | ||
val userId: Int | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,10 +58,10 @@ class PlaceDetailViewModel @Inject constructor( | |
} | ||
} | ||
|
||
fun useSpoon(userId: Int, postId: Int) { | ||
fun useSpoon(postId: Int, userId: Int) { | ||
viewModelScope.launch { | ||
postRepository.postScoopPost(userId = userId, postId = postId) | ||
.onSuccess { response -> | ||
postRepository.postScoopPost(postId = postId, userId = userId) | ||
.onSuccess { | ||
(_state.value.postEntity as? UiState.Success)?.data?.let { currentPostEntity -> | ||
with(currentPostEntity) { | ||
_state.update { | ||
|
@@ -75,7 +75,17 @@ class PlaceDetailViewModel @Inject constructor( | |
} | ||
} | ||
.onFailure { | ||
// 실패 했을 경우 | ||
(_state.value.postEntity as? UiState.Success)?.data?.let { currentPostEntity -> | ||
with(currentPostEntity) { | ||
_state.update { | ||
it.copy( | ||
postEntity = UiState.Success( | ||
copy(isScooped = false) | ||
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. P2: 여기에 copy가 왜 또 들어가나요..???? 위에서 copy 해주고 있어서 안쪽에서는 안해도 될 것 같습니다! 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. 수정했습니다! |
||
) | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
P2: onFailure일 때도 UiState.Success로 넣어주고 있네요!! 제 생각에는 Failure로 해줘야 더 명확하지 않을까 싶습니다 세홍님 생각은 어떠세요?
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.
수정했습니다!