-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
44 changed files
with
229 additions
and
140 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
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
8 changes: 8 additions & 0 deletions
8
data/src/main/java/co/orange/data/dataSource/HomeDataSource.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,8 @@ | ||
package co.orange.data.dataSource | ||
|
||
import co.orange.data.dto.BaseResponse | ||
import co.orange.data.dto.response.HomeDto | ||
|
||
interface HomeDataSource { | ||
suspend fun getHomeData(): BaseResponse<HomeDto> | ||
} |
15 changes: 15 additions & 0 deletions
15
data/src/main/java/co/orange/data/dataSourceImpl/HomeDataSourceImpl.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,15 @@ | ||
package co.orange.data.dataSourceImpl | ||
|
||
import co.orange.data.dataSource.HomeDataSource | ||
import co.orange.data.dto.BaseResponse | ||
import co.orange.data.dto.response.HomeDto | ||
import co.orange.data.service.HomeService | ||
import javax.inject.Inject | ||
|
||
data class HomeDataSourceImpl | ||
@Inject | ||
constructor( | ||
private val homeService: HomeService, | ||
) : HomeDataSource { | ||
override suspend fun getHomeData(): BaseResponse<HomeDto> = homeService.getHomeData() | ||
} |
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
14 changes: 0 additions & 14 deletions
14
data/src/main/java/co/orange/data/dto/NonDataBaseResponse.kt
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package co.orange.data.dto.response | ||
|
||
import co.orange.domain.entity.response.HomeModel | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class HomeDto( | ||
@SerialName("homeImgUrl") | ||
val homeImgUrl: String, | ||
@SerialName("productList") | ||
val productList: List<ProductDto>, | ||
) { | ||
fun toModel() = HomeModel(homeImgUrl, productList.map { it.toModel() }) | ||
} |
25 changes: 25 additions & 0 deletions
25
data/src/main/java/co/orange/data/dto/response/ProductDto.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,25 @@ | ||
package co.orange.data.dto.response | ||
|
||
import co.orange.domain.entity.response.ProductModel | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ProductDto( | ||
@SerialName("productId") | ||
val productId: String, | ||
@SerialName("kakaoProductId") | ||
val kakaoProductId: Long, | ||
@SerialName("name") | ||
val name: String, | ||
@SerialName("imgUrl") | ||
val imgUrl: String, | ||
@SerialName("originPrice") | ||
val originPrice: Int, | ||
@SerialName("salePrice") | ||
val salePrice: Int, | ||
@SerialName("interestCount") | ||
val interestCount: Int, | ||
) { | ||
fun toModel() = ProductModel(productId, kakaoProductId, name, imgUrl, originPrice, salePrice, interestCount) | ||
} |
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
14 changes: 14 additions & 0 deletions
14
data/src/main/java/co/orange/data/repositoryImpl/HomeRepositoryImpl.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,14 @@ | ||
package co.orange.data.repositoryImpl | ||
|
||
import co.orange.data.dataSource.HomeDataSource | ||
import co.orange.domain.entity.response.HomeModel | ||
import co.orange.domain.repository.HomeRepository | ||
import javax.inject.Inject | ||
|
||
class HomeRepositoryImpl | ||
@Inject | ||
constructor( | ||
private val homeDataSource: HomeDataSource, | ||
) : HomeRepository { | ||
override suspend fun getHomeData(): Result<HomeModel> = runCatching { homeDataSource.getHomeData().data.toModel() } | ||
} |
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,10 @@ | ||
package co.orange.data.service | ||
|
||
import co.orange.data.dto.BaseResponse | ||
import co.orange.data.dto.response.HomeDto | ||
import retrofit2.http.GET | ||
|
||
interface HomeService { | ||
@GET("/api/v1/home") | ||
suspend fun getHomeData(): BaseResponse<HomeDto> | ||
} |
6 changes: 6 additions & 0 deletions
6
domain/src/main/kotlin/co/orange/domain/entity/response/HomeModel.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,6 @@ | ||
package co.orange.domain.entity.response | ||
|
||
data class HomeModel( | ||
val homeImgUrl: String, | ||
val productList: List<ProductModel>, | ||
) |
5 changes: 3 additions & 2 deletions
5
domain/src/main/kotlin/co/orange/domain/entity/response/ProductModel.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,11 @@ | ||
package co.orange.domain.entity.response | ||
|
||
data class ProductModel( | ||
val productId: Long, | ||
val productId: String, | ||
val kakaoProductId: Long, | ||
val name: String, | ||
val imgUrl: String, | ||
val originPrice: Int, | ||
val salePrice: Int, | ||
val interestCount: Int, | ||
) | ||
) |
7 changes: 7 additions & 0 deletions
7
domain/src/main/kotlin/co/orange/domain/repository/HomeRepository.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.orange.domain.repository | ||
|
||
import co.orange.domain.entity.response.HomeModel | ||
|
||
interface HomeRepository { | ||
suspend fun getHomeData(): Result<HomeModel> | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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.