-
Notifications
You must be signed in to change notification settings - Fork 2
[Feat/#163] 마이페이지 관련 API 작업 #165
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ecc7d5c
[feat/#163] mypageDto 작업
vvan2 a41738f
[feat/#163] mypageRepository 작업
vvan2 733e6f3
[feat/#163] mypagedatasource 작업
vvan2 c02e7a5
[feat/#163] mypage entity
vvan2 a74d992
[feat/#163] mypage 관련 module 추가
vvan2 c5d48b3
[feat/#163] conflict resolve
vvan2 5f8ef6b
[feat/#163] buildConfigField 추가
vvan2 1575612
[feat/#163] mypage 네비게이션 수정
vvan2 50be516
[feat/#163] mypagservice
vvan2 a239b70
[feat/#163] mypage 코스 뷰
vvan2 bf562e3
[feat/#163] mypage 반려견 뷰
vvan2 75777e2
[feat/#163] mypage 유저 뷰
vvan2 14f5e6d
[feat/#163] mypage 메인 뷰
vvan2 97fd9bf
[feat/#165] : merge from develop
vvan2 2160d12
[feat/#165] : conflict resolve
vvan2 151727e
[feat/#165] : conflict resolve
vvan2 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 hidden or 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 hidden or 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 hidden or 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
21 changes: 21 additions & 0 deletions
21
app/src/main/java/com/paw/key/data/dto/request/mypage/MypageRequestDto.kt
This file contains hidden or 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,21 @@ | ||
| package com.paw.key.data.dto.request.mypage | ||
|
|
||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class UpdateUserRequestDto( | ||
| @SerialName("name") val name: String, | ||
| @SerialName("birth") val birth: String, | ||
| @SerialName("gender") val gender: String, | ||
| ) | ||
|
|
||
| @Serializable | ||
| data class UpdatePetRequestDto( | ||
| @SerialName("name") val name: String, | ||
| @SerialName("birth") val birth: String, | ||
| @SerialName("gender") val gender: String, | ||
| @SerialName("isNeutered") val isNeutered: Boolean, | ||
| @SerialName("breedId") val breedId: Int, | ||
| @SerialName("imageId") val imageId: Int, | ||
| ) |
34 changes: 34 additions & 0 deletions
34
app/src/main/java/com/paw/key/data/dto/response/mypage/MypageResponseDto.kt
This file contains hidden or 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,34 @@ | ||
| package com.paw.key.data.dto.response.mypage | ||
|
|
||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class RoutePostListResponseDto( | ||
| @SerialName("posts") val posts: List<RoutePostDto>, | ||
| ) | ||
|
|
||
| @Serializable | ||
| data class RoutePostDto( | ||
| @SerialName("postId") val postId: Int, | ||
| @SerialName("regionName") val regionName: String, | ||
| @SerialName("title") val title: String, | ||
| @SerialName("date") val date: String, | ||
| @SerialName("durationMinutes") val durationMinutes: Int, | ||
| @SerialName("isLiked") val isLiked: Boolean, | ||
| @SerialName("imageUrl") val imageUrl: String, | ||
| ) | ||
|
|
||
| @Serializable | ||
| data class ReviewPostListResponseDto( | ||
| @SerialName("posts") val posts: List<ReviewPostDto>, | ||
| ) | ||
|
|
||
| @Serializable | ||
| data class ReviewPostDto( | ||
| @SerialName("postId") val postId: Int, | ||
| @SerialName("title") val title: String, | ||
| @SerialName("regionName") val regionName: String, | ||
| @SerialName("date") val date: String, | ||
| @SerialName("categoryOptionSummary") val categoryOptionSummary: List<String>, | ||
| ) |
29 changes: 29 additions & 0 deletions
29
app/src/main/java/com/paw/key/data/remote/datasource/datasourceimpl/MypageDataSourceImpl.kt
This file contains hidden or 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,29 @@ | ||
| package com.paw.key.data.remote.datasource.mypage | ||
|
|
||
| import com.paw.key.data.dto.request.mypage.UpdatePetRequestDto | ||
| import com.paw.key.data.dto.request.mypage.UpdateUserRequestDto | ||
| import com.paw.key.data.dto.response.BaseResponse | ||
| import com.paw.key.data.dto.response.mypage.ReviewPostListResponseDto | ||
| import com.paw.key.data.dto.response.mypage.RoutePostListResponseDto | ||
| import com.paw.key.data.service.mypage.MypageService | ||
| import javax.inject.Inject | ||
|
|
||
| class MypageDataSourceImpl @Inject constructor( | ||
| private val mypageService: MypageService, | ||
| ) : MypageDataSource { | ||
|
|
||
| override suspend fun updateUser(body: UpdateUserRequestDto): BaseResponse<Unit> = | ||
| mypageService.updateUser(body) | ||
|
|
||
| override suspend fun updatePet(body: UpdatePetRequestDto): BaseResponse<Unit> = | ||
| mypageService.updatePet(body) | ||
|
|
||
| override suspend fun getMyRoutes(): BaseResponse<RoutePostListResponseDto> = | ||
| mypageService.getMyRoutes() | ||
|
|
||
| override suspend fun getLikedPosts(): BaseResponse<RoutePostListResponseDto> = | ||
| mypageService.getLikedPosts() | ||
|
|
||
| override suspend fun getMyReviews(): BaseResponse<ReviewPostListResponseDto> = | ||
| mypageService.getMyReviews() | ||
| } |
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/paw/key/data/remote/datasource/mypage/MypageDataSource.kt
This file contains hidden or 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,15 @@ | ||
| package com.paw.key.data.remote.datasource.mypage | ||
|
|
||
| import com.paw.key.data.dto.request.mypage.UpdatePetRequestDto | ||
| import com.paw.key.data.dto.request.mypage.UpdateUserRequestDto | ||
| import com.paw.key.data.dto.response.BaseResponse | ||
| import com.paw.key.data.dto.response.mypage.ReviewPostListResponseDto | ||
| import com.paw.key.data.dto.response.mypage.RoutePostListResponseDto | ||
|
|
||
| interface MypageDataSource { | ||
| suspend fun updateUser(body: UpdateUserRequestDto): BaseResponse<Unit> | ||
| suspend fun updatePet(body: UpdatePetRequestDto): BaseResponse<Unit> | ||
| suspend fun getMyRoutes(): BaseResponse<RoutePostListResponseDto> | ||
| suspend fun getLikedPosts(): BaseResponse<RoutePostListResponseDto> | ||
| suspend fun getMyReviews(): BaseResponse<ReviewPostListResponseDto> | ||
| } |
56 changes: 56 additions & 0 deletions
56
app/src/main/java/com/paw/key/data/repositoryimpl/mypage/MypageRepositoryImpl.kt
This file contains hidden or 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,56 @@ | ||
| package com.paw.key.data.repository.mypage | ||
|
|
||
| import com.paw.key.core.util.suspendRunCatching | ||
| import com.paw.key.data.dto.request.mypage.UpdatePetRequestDto | ||
| import com.paw.key.data.dto.request.mypage.UpdateUserRequestDto | ||
| import com.paw.key.data.remote.datasource.mypage.MypageDataSource | ||
| import com.paw.key.domain.entity.mypage.ReviewPostEntity | ||
| import com.paw.key.domain.entity.mypage.RoutePostEntity | ||
| import com.paw.key.domain.entity.mypage.toEntity | ||
| import com.paw.key.domain.repository.mypage.MypageRepository | ||
| import javax.inject.Inject | ||
|
|
||
| class MypageRepositoryImpl @Inject constructor( | ||
| private val dataSource: MypageDataSource, | ||
| ) : MypageRepository { | ||
|
|
||
| override suspend fun updateUser(name: String, birth: String, gender: String): Result<Unit> = | ||
| suspendRunCatching { | ||
| dataSource.updateUser(UpdateUserRequestDto(name = name, birth = birth, gender = gender)) | ||
| } | ||
|
|
||
| override suspend fun updatePet( | ||
| name: String, | ||
| birth: String, | ||
| gender: String, | ||
| isNeutered: Boolean, | ||
| breedId: Int, | ||
| imageId: Int, | ||
| ): Result<Unit> = suspendRunCatching { | ||
| dataSource.updatePet( | ||
| UpdatePetRequestDto( | ||
| name = name, | ||
| birth = birth, | ||
| gender = gender, | ||
| isNeutered = isNeutered, | ||
| breedId = breedId, | ||
| imageId = imageId, | ||
| ) | ||
| ) | ||
| } | ||
|
|
||
| override suspend fun getMyRoutes(): Result<List<RoutePostEntity>> = | ||
| suspendRunCatching { | ||
| dataSource.getMyRoutes().data?.posts?.map { it.toEntity() } ?: emptyList() | ||
| } | ||
|
|
||
| override suspend fun getLikedPosts(): Result<List<RoutePostEntity>> = | ||
| suspendRunCatching { | ||
| dataSource.getLikedPosts().data?.posts?.map { it.toEntity() } ?: emptyList() | ||
| } | ||
|
|
||
| override suspend fun getMyReviews(): Result<List<ReviewPostEntity>> = | ||
| suspendRunCatching { | ||
| dataSource.getMyReviews().data?.posts?.map { it.toEntity() } ?: emptyList() | ||
| } | ||
| } |
32 changes: 32 additions & 0 deletions
32
app/src/main/java/com/paw/key/data/service/mypage/MypageService.kt
This file contains hidden or 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,32 @@ | ||
| package com.paw.key.data.service.mypage | ||
|
|
||
| import com.paw.key.data.dto.request.mypage.UpdatePetRequestDto | ||
| import com.paw.key.data.dto.request.mypage.UpdateUserRequestDto | ||
| import com.paw.key.data.dto.response.BaseResponse | ||
| import com.paw.key.data.dto.response.mypage.ReviewPostListResponseDto | ||
| import com.paw.key.data.dto.response.mypage.RoutePostListResponseDto | ||
| import retrofit2.http.Body | ||
| import retrofit2.http.GET | ||
| import retrofit2.http.PATCH | ||
|
|
||
| interface MypageService { | ||
|
|
||
| @PATCH("users/me") | ||
| suspend fun updateUser( | ||
| @Body body: UpdateUserRequestDto, | ||
| ): BaseResponse<Unit> | ||
|
|
||
| @PATCH("pets/me") | ||
| suspend fun updatePet( | ||
| @Body body: UpdatePetRequestDto, | ||
| ): BaseResponse<Unit> | ||
|
|
||
| @GET("users/me/routes") | ||
| suspend fun getMyRoutes(): BaseResponse<RoutePostListResponseDto> | ||
|
|
||
| @GET("users/me/likes") | ||
| suspend fun getLikedPosts(): BaseResponse<RoutePostListResponseDto> | ||
|
|
||
| @GET("users/me/reviews") | ||
| suspend fun getMyReviews(): BaseResponse<ReviewPostListResponseDto> | ||
| } |
40 changes: 40 additions & 0 deletions
40
app/src/main/java/com/paw/key/domain/entity/mypage/MypageEntity.kt
This file contains hidden or 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,40 @@ | ||
| package com.paw.key.domain.entity.mypage | ||
|
|
||
| import com.paw.key.data.dto.response.mypage.ReviewPostDto | ||
| import com.paw.key.data.dto.response.mypage.RoutePostDto | ||
|
|
||
| data class RoutePostEntity( | ||
| val postId: Int, | ||
| val regionName: String, | ||
| val title: String, | ||
| val date: String, | ||
| val durationMinutes: Int, | ||
| val isLiked: Boolean, | ||
| val imageUrl: String, | ||
| ) | ||
|
|
||
| data class ReviewPostEntity( | ||
| val postId: Int, | ||
| val title: String, | ||
| val regionName: String, | ||
| val date: String, | ||
| val categoryOptionSummary: List<String>, | ||
| ) | ||
|
|
||
| fun RoutePostDto.toEntity() = RoutePostEntity( | ||
| postId = postId, | ||
| regionName = regionName, | ||
| title = title, | ||
| date = date, | ||
| durationMinutes = durationMinutes, | ||
| isLiked = isLiked, | ||
| imageUrl = imageUrl, | ||
| ) | ||
|
|
||
| fun ReviewPostDto.toEntity() = ReviewPostEntity( | ||
| postId = postId, | ||
| title = title, | ||
| regionName = regionName, | ||
| date = date, | ||
| categoryOptionSummary = categoryOptionSummary, | ||
| ) | ||
|
Comment on lines
+24
to
+40
Member
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. 우리 이제 클린이라 dto안에 toEntity 가 존재해야합니다! 의존성 바뀌었어요 도하하~ |
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -11,4 +11,4 @@ data class PetProfileEntity( | |
| val breed: String, | ||
| val dbtiName: String?, | ||
| val dbtiDescription: String?, | ||
| ) | ||
| ) | ||
12 changes: 12 additions & 0 deletions
12
app/src/main/java/com/paw/key/domain/repository/mypage/MypageRepository.kt
This file contains hidden or 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.paw.key.domain.repository.mypage | ||
|
|
||
| import com.paw.key.domain.entity.mypage.ReviewPostEntity | ||
| import com.paw.key.domain.entity.mypage.RoutePostEntity | ||
|
|
||
| interface MypageRepository { | ||
| suspend fun updateUser(name: String, birth: String, gender: String): Result<Unit> | ||
| suspend fun updatePet(name: String, birth: String, gender: String, isNeutered: Boolean, breedId: Int, imageId: Int): Result<Unit> | ||
| suspend fun getMyRoutes(): Result<List<RoutePostEntity>> | ||
| suspend fun getLikedPosts(): Result<List<RoutePostEntity>> | ||
| suspend fun getMyReviews(): Result<List<ReviewPostEntity>> | ||
| } |
7 changes: 0 additions & 7 deletions
7
app/src/main/java/com/paw/key/domain/repository/petprofile/PetProfileRepository.kt
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
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.
이것도 아마 pull 하면 생길..듯?합니다