-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from PawWithU/feature/notice_detail
feat/notice_detail: 이동봉사 공고 상세 화면 api 연결
- Loading branch information
Showing
29 changed files
with
355 additions
and
106 deletions.
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
13 changes: 13 additions & 0 deletions
13
...com/kusitms/connectdog/core/data/api/model/intermediator/IntermediatorInfoResponseItem.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,13 @@ | ||
package com.kusitms.connectdog.core.data.api.model.intermediator | ||
|
||
data class IntermediatorInfoResponseItem( | ||
val completedPostCount: Long, | ||
val contact: String, | ||
val dogStatusCount: Long, | ||
val guide: String, | ||
val intro: String, | ||
val name: String, | ||
val profileImage: String, | ||
val reviewCount: Long, | ||
val url: String | ||
) |
24 changes: 24 additions & 0 deletions
24
...ain/java/com/kusitms/connectdog/core/data/api/model/volunteer/NoticeDetailResponseItem.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,24 @@ | ||
package com.kusitms.connectdog.core.data.api.model.volunteer | ||
|
||
data class NoticeDetailResponseItem( | ||
val arrivalLoc: String, | ||
val content: String, | ||
val departureLoc: String, | ||
val dogGender: String, | ||
val dogName: String, | ||
val dogSize: String, | ||
val dogWeight: Double, | ||
val endDate: String, | ||
val images: List<String>, | ||
val intermediaryId: Int, | ||
val intermediaryName: String, | ||
val intermediaryProfileImage: String, | ||
val isBookmark: Boolean, | ||
val isKennel: Boolean, | ||
val mainImage: String, | ||
val pickUpTime: String, | ||
val postId: Int, | ||
val postStatus: String, | ||
val specifics: String?, | ||
val startDate: String | ||
) |
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
11 changes: 11 additions & 0 deletions
11
core/data/src/main/java/com/kusitms/connectdog/core/data/repository/DetailRepository.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,11 @@ | ||
package com.kusitms.connectdog.core.data.repository | ||
|
||
import com.kusitms.connectdog.core.data.api.model.intermediator.IntermediatorInfoResponseItem | ||
import com.kusitms.connectdog.core.data.api.model.volunteer.BookmarkResponseItem | ||
import com.kusitms.connectdog.core.data.api.model.volunteer.NoticeDetailResponseItem | ||
|
||
interface DetailRepository { | ||
suspend fun getNoticeDetail(postId: Long): NoticeDetailResponseItem | ||
suspend fun getIntermediatorInfo(intermediaryId: Long): IntermediatorInfoResponseItem | ||
suspend fun getIntermediatorReview(intermediaryId: Long): List<BookmarkResponseItem> | ||
} |
23 changes: 23 additions & 0 deletions
23
core/data/src/main/java/com/kusitms/connectdog/core/data/repository/DetailRepositoryImpl.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,23 @@ | ||
package com.kusitms.connectdog.core.data.repository | ||
|
||
import com.kusitms.connectdog.core.data.api.ApiService | ||
import com.kusitms.connectdog.core.data.api.model.intermediator.IntermediatorInfoResponseItem | ||
import com.kusitms.connectdog.core.data.api.model.volunteer.BookmarkResponseItem | ||
import com.kusitms.connectdog.core.data.api.model.volunteer.NoticeDetailResponseItem | ||
import javax.inject.Inject | ||
|
||
internal class DetailRepositoryImpl @Inject constructor( | ||
private val api: ApiService | ||
) : DetailRepository { | ||
override suspend fun getNoticeDetail(postId: Long): NoticeDetailResponseItem { | ||
return api.getNoticeDetail(postId) | ||
} | ||
|
||
override suspend fun getIntermediatorInfo(intermediaryId: Long): IntermediatorInfoResponseItem { | ||
return api.getIntermediatorInfo(intermediaryId) | ||
} | ||
|
||
override suspend fun getIntermediatorReview(intermediaryId: Long): List<BookmarkResponseItem> { | ||
return api.getIntermediatorReview(intermediaryId) | ||
} | ||
} |
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
26 changes: 26 additions & 0 deletions
26
feature/home/src/main/java/com/kusitms/connectdog/feature/home/DetailViewModel.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,26 @@ | ||
package com.kusitms.connectdog.feature.home | ||
|
||
import androidx.lifecycle.LiveData | ||
import androidx.lifecycle.MutableLiveData | ||
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.viewModelScope | ||
import com.kusitms.connectdog.core.data.api.model.volunteer.NoticeDetailResponseItem | ||
import com.kusitms.connectdog.core.data.repository.DetailRepository | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import kotlinx.coroutines.launch | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class DetailViewModel @Inject constructor( | ||
private val detailRepository: DetailRepository | ||
) : ViewModel() { | ||
private val _detail = MutableLiveData<NoticeDetailResponseItem>() | ||
val detail: LiveData<NoticeDetailResponseItem> = _detail | ||
|
||
fun initNoticeDetail(postId: Long) { | ||
viewModelScope.launch { | ||
val response = detailRepository.getNoticeDetail(postId) | ||
_detail.postValue(response) | ||
} | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...e/home/src/main/java/com/kusitms/connectdog/feature/home/IntermediatorProfileViewModel.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,40 @@ | ||
package com.kusitms.connectdog.feature.home | ||
|
||
import android.util.Log | ||
import androidx.lifecycle.LiveData | ||
import androidx.lifecycle.MutableLiveData | ||
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.viewModelScope | ||
import com.kusitms.connectdog.core.data.api.model.intermediator.IntermediatorInfoResponseItem | ||
import com.kusitms.connectdog.core.data.api.model.volunteer.BookmarkResponseItem | ||
import com.kusitms.connectdog.core.data.repository.DetailRepository | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import kotlinx.coroutines.launch | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class IntermediatorProfileViewModel @Inject constructor( | ||
private val detailRepository: DetailRepository | ||
) : ViewModel() { | ||
private val _intermediator = MutableLiveData<IntermediatorInfoResponseItem>() | ||
val intermediator: LiveData<IntermediatorInfoResponseItem> = _intermediator | ||
|
||
private val _review = MutableLiveData<List<BookmarkResponseItem>>() | ||
val notice: LiveData<List<BookmarkResponseItem>> = _review | ||
|
||
fun initIntermediatorProfile(intermediaryId: Long) { | ||
viewModelScope.launch { | ||
val response = detailRepository.getIntermediatorInfo(intermediaryId) | ||
_intermediator.postValue(response) | ||
} | ||
} | ||
|
||
fun initIntermediatorReview(intermediaryId: Long) { | ||
viewModelScope.launch { | ||
val response = detailRepository.getIntermediatorReview(intermediaryId) | ||
_review.postValue(response) | ||
|
||
Log.d("testtt", response.toString()) | ||
} | ||
} | ||
} |
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
Oops, something went wrong.