-
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.
- Loading branch information
Showing
24 changed files
with
281 additions
and
87 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
6 changes: 3 additions & 3 deletions
6
app/src/main/java/co/kr/bemyplan/data/api/HomePopularService.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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package co.kr.bemyplan.data.api | ||
|
||
import co.kr.bemyplan.data.entity.main.home.ResponseHomePopularData | ||
import co.kr.bemyplan.data.entity.main.home.ResponseHomeData | ||
import retrofit2.Call | ||
import retrofit2.http.GET | ||
|
||
interface HomePopularService { | ||
@GET("/api/v1/post/popular") | ||
fun getPopularData(): Call<ResponseHomePopularData> | ||
@GET("/v1/plans?size=10&sort=orderCnt,desc") | ||
suspend fun getPopularData(): ResponseHomeData | ||
} |
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
24 changes: 6 additions & 18 deletions
24
app/src/main/java/co/kr/bemyplan/data/entity/main/home/ResponseHomeData.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 |
---|---|---|
@@ -1,26 +1,14 @@ | ||
package co.kr.bemyplan.data.entity.main.home | ||
|
||
import com.google.gson.annotations.SerializedName | ||
import co.kr.bemyplan.domain.model.main.home.HomeDomainData | ||
|
||
data class ResponseHomeData( | ||
val data: ResponseHomeItems, | ||
val totalPage : Int | ||
val message : String, | ||
val resultCode : String | ||
){ | ||
data class ResponseHomeItems( | ||
val items: List<HomeData> | ||
){ | ||
data class HomeData( | ||
@SerializedName("post_id") | ||
val postId: Int, | ||
val title: String, | ||
val author : String, | ||
@SerializedName("thumbnail_url") | ||
val thumbnailUrl: String, | ||
val price: Int, | ||
@SerializedName("is_purchased") | ||
val isPurchased : Boolean, | ||
@SerializedName("is_scraped") | ||
val isScraped : Boolean | ||
) | ||
} | ||
val contents : List<HomeDomainData>, | ||
val nextCursor : Int | ||
) | ||
} |
19 changes: 0 additions & 19 deletions
19
app/src/main/java/co/kr/bemyplan/data/entity/main/home/ResponseHomePopularData.kt
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
app/src/main/java/co/kr/bemyplan/data/repository/main/home/HomeNewRepositoryImpl.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,19 @@ | ||
package co.kr.bemyplan.data.repository.main.home | ||
|
||
import co.kr.bemyplan.data.api.HomeNewService | ||
import co.kr.bemyplan.domain.model.main.home.HomeDomainData | ||
import co.kr.bemyplan.domain.repository.HomeNewRepository | ||
import kotlinx.coroutines.CoroutineDispatcher | ||
import kotlinx.coroutines.withContext | ||
import javax.inject.Inject | ||
|
||
class HomeNewRepositoryImpl @Inject constructor( | ||
private val homeNewService : HomeNewService, | ||
private val coroutineDispatcher: CoroutineDispatcher | ||
) : HomeNewRepository { | ||
override suspend fun getHomeNewData(): List<HomeDomainData> { | ||
return withContext(coroutineDispatcher){ | ||
homeNewService.getNewData().data.contents | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/src/main/java/co/kr/bemyplan/data/repository/main/home/HomePopularRepositoryImpl.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,19 @@ | ||
package co.kr.bemyplan.data.repository.main.home | ||
|
||
import co.kr.bemyplan.data.api.HomePopularService | ||
import co.kr.bemyplan.domain.model.main.home.HomeDomainData | ||
import co.kr.bemyplan.domain.repository.HomePopularRepository | ||
import kotlinx.coroutines.CoroutineDispatcher | ||
import kotlinx.coroutines.withContext | ||
import javax.inject.Inject | ||
|
||
class HomePopularRepositoryImpl @Inject constructor( | ||
private val homePopularService: HomePopularService, | ||
private val coroutineDispatcher: CoroutineDispatcher | ||
) : HomePopularRepository { | ||
override suspend fun getHomePopularData(): List<HomeDomainData> { | ||
return withContext(coroutineDispatcher){ | ||
homePopularService.getPopularData().data.contents | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/src/main/java/co/kr/bemyplan/data/repository/main/home/HomeSuggestRepositoryImpl.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,19 @@ | ||
package co.kr.bemyplan.data.repository.main.home | ||
|
||
import co.kr.bemyplan.data.api.HomeSuggestService | ||
import co.kr.bemyplan.domain.model.main.home.HomeDomainData | ||
import co.kr.bemyplan.domain.repository.HomeSuggestRepository | ||
import kotlinx.coroutines.CoroutineDispatcher | ||
import kotlinx.coroutines.withContext | ||
import javax.inject.Inject | ||
|
||
class HomeSuggestRepositoryImpl @Inject constructor( | ||
private val homeSuggestService: HomeSuggestService, | ||
private val coroutineDispatcher: CoroutineDispatcher | ||
) : HomeSuggestRepository { | ||
override suspend fun getHomeSuggestData(): List<HomeDomainData> { | ||
return withContext(coroutineDispatcher){ | ||
homeSuggestService.getSuggestData().data.contents | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -16,5 +16,4 @@ class LocationRepositoryImpl @Inject constructor( | |
locationservice.getLocation().data | ||
} | ||
} | ||
|
||
} |
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
17 changes: 17 additions & 0 deletions
17
app/src/main/java/co/kr/bemyplan/domain/model/main/home/HomeDomainData.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,17 @@ | ||
package co.kr.bemyplan.domain.model.main.home | ||
|
||
data class HomeDomainData( | ||
val createdAt : String, | ||
val orderStatus : Boolean, | ||
val planId: Int, | ||
val scrapStatus : Boolean, | ||
val thumbnailUrl: String, | ||
val title: String, | ||
val updatedAt : String, | ||
val user : UserData, | ||
){ | ||
data class UserData( | ||
val nickname : String, | ||
val userId : Int | ||
) | ||
} |
7 changes: 7 additions & 0 deletions
7
app/src/main/java/co/kr/bemyplan/domain/repository/HomeNewRepository.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,7 @@ | ||
package co.kr.bemyplan.domain.repository | ||
|
||
import co.kr.bemyplan.domain.model.main.home.HomeDomainData | ||
|
||
interface HomeNewRepository { | ||
suspend fun getHomeNewData():List<HomeDomainData> | ||
} |
7 changes: 7 additions & 0 deletions
7
app/src/main/java/co/kr/bemyplan/domain/repository/HomePopularRepository.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,7 @@ | ||
package co.kr.bemyplan.domain.repository | ||
|
||
import co.kr.bemyplan.domain.model.main.home.HomeDomainData | ||
|
||
interface HomePopularRepository { | ||
suspend fun getHomePopularData():List<HomeDomainData> | ||
} |
7 changes: 7 additions & 0 deletions
7
app/src/main/java/co/kr/bemyplan/domain/repository/HomeSuggestRepository.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,7 @@ | ||
package co.kr.bemyplan.domain.repository | ||
|
||
import co.kr.bemyplan.domain.model.main.home.HomeDomainData | ||
|
||
interface HomeSuggestRepository { | ||
suspend fun getHomeSuggestData():List<HomeDomainData> | ||
} |
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.