Skip to content

Commit

Permalink
[feat] : #113 data layer 패키지 명 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
SsongSik committed Jun 2, 2023
1 parent cff389a commit 0c4d6de
Show file tree
Hide file tree
Showing 29 changed files with 79 additions and 92 deletions.
2 changes: 2 additions & 0 deletions data/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ dependencies {
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation project(path: ':domain')
implementation project(path: ':app')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
Expand Down
9 changes: 6 additions & 3 deletions data/src/main/java/com/myongsik/data/api/HomeFoodApi.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.myongsik.data.api


import com.myongsik.myongsikandroid.data.model.food.*
import com.myongsik.myongsikandroid.data.model.review.RequestReviewData
import com.myongsik.myongsikandroid.data.model.review.ResponseReviewData
import com.myongsik.data.model.food.DayFoodResponse
import com.myongsik.data.model.food.RankRestaurantResponse
import com.myongsik.data.model.food.ResponseOneRestaurant
import com.myongsik.data.model.food.WeekFoodResponse
import com.myongsik.data.model.review.RequestReviewData
import com.myongsik.data.model.review.ResponseReviewData
import retrofit2.Response
import retrofit2.http.*

Expand Down
4 changes: 2 additions & 2 deletions data/src/main/java/com/myongsik/data/api/RestaurantApi.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.myongsik.data.api

import com.myongsik.myongsikandroid.data.model.restaurant.RequestScrap
import com.myongsik.myongsikandroid.data.model.restaurant.ResponseScrap
import com.myongsik.data.model.restaurant.RequestScrap
import com.myongsik.data.model.restaurant.ResponseScrap
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.POST
Expand Down
3 changes: 1 addition & 2 deletions data/src/main/java/com/myongsik/data/api/SearchFoodApi.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.myongsik.data.api


import com.myongsik.myongsikandroid.data.model.kakao.SearchResponse
import com.myongsik.data.model.kakao.SearchResponse
import com.myongsik.myongsikandroid.util.Constant
import com.myongsik.myongsikandroid.util.Constant.API_KEY
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Response
Expand Down
4 changes: 2 additions & 2 deletions data/src/main/java/com/myongsik/data/api/UserApi.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.myongsik.data.api

import com.myongsik.myongsikandroid.data.model.user.RequestUserData
import com.myongsik.myongsikandroid.data.model.user.ResponseUserData
import com.myongsik.data.model.user.RequestUserData
import com.myongsik.data.model.user.ResponseUserData
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.POST
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.myongsik.data.datasource.food

import com.myongsik.myongsikandroid.domain.model.food.RequestReviewDataEntity
import com.myongsik.myongsikandroid.domain.model.food.ResponseReviewDataEntity
import com.myongsik.myongsikandroid.domain.model.food.ResponseWeekFoodEntity
import com.myongsik.domain.model.food.RequestReviewDataEntity
import com.myongsik.domain.model.food.ResponseReviewDataEntity
import com.myongsik.domain.model.food.ResponseWeekFoodEntity

interface FoodDataSource {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package com.myongsik.data.datasource.food

import android.util.Log
import com.myongsik.data.api.HomeFoodApi
import com.myongsik.myongsikandroid.data.model.food.toWeekFoodEntity
import com.myongsik.myongsikandroid.data.model.review.toRequestReviewData
import com.myongsik.myongsikandroid.data.model.review.toResponseReviewEntity
import com.myongsik.myongsikandroid.domain.model.food.RequestReviewDataEntity
import com.myongsik.myongsikandroid.domain.model.food.ResponseReviewDataEntity
import com.myongsik.myongsikandroid.domain.model.food.ResponseWeekFoodEntity
import com.myongsik.data.model.food.toWeekFoodEntity
import com.myongsik.data.model.review.toRequestReviewData
import com.myongsik.data.model.review.toResponseReviewEntity
import com.myongsik.domain.model.food.RequestReviewDataEntity
import com.myongsik.domain.model.food.ResponseReviewDataEntity
import com.myongsik.domain.model.food.ResponseWeekFoodEntity
import javax.inject.Inject

class FoodDataSourceImpl @Inject constructor(
Expand All @@ -26,10 +24,8 @@ class FoodDataSourceImpl @Inject constructor(
override suspend fun postReview(requestReviewDataEntity: RequestReviewDataEntity): ResponseReviewDataEntity? {
val response = homeFoodApi.postReview(requestReviewDataEntity.toRequestReviewData())
return if(response.isSuccessful) {
Log.d("gg1234", response.body().toString())
response.body()?.toResponseReviewEntity()
} else {
Log.d("gg1234", "Error")
null
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.myongsik.data.datasource.restaurant

import androidx.paging.PagingData
import com.myongsik.myongsikandroid.domain.model.restaurant.RequestScrapEntity
import com.myongsik.myongsikandroid.domain.model.restaurant.ResponseScrapEntity
import com.myongsik.myongsikandroid.domain.model.restaurant.RestaurantEntity
import com.myongsik.domain.model.restaurant.RequestScrapEntity
import com.myongsik.domain.model.restaurant.ResponseScrapEntity
import com.myongsik.domain.model.restaurant.RestaurantEntity
import kotlinx.coroutines.flow.Flow

interface RestaurantDataSource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import androidx.paging.Pager
import androidx.paging.PagingConfig
import androidx.paging.PagingData
import androidx.paging.map
import com.myongsik.data.api.RestaurantApi
import com.myongsik.myongsikandroid.data.db.RestaurantDatabase
import com.myongsik.myongsikandroid.data.model.kakao.toRestaurantData
import com.myongsik.myongsikandroid.data.model.kakao.toRestaurantEntity
import com.myongsik.myongsikandroid.data.model.restaurant.toRequestScrapData
import com.myongsik.myongsikandroid.data.model.restaurant.toResponseScrapEntity
import com.myongsik.myongsikandroid.domain.model.restaurant.RequestScrapEntity
import com.myongsik.myongsikandroid.domain.model.restaurant.ResponseScrapEntity
import com.myongsik.myongsikandroid.domain.model.restaurant.RestaurantEntity
import com.myongsik.data.db.RestaurantDatabase
import com.myongsik.data.model.kakao.toRestaurantData
import com.myongsik.data.model.kakao.toRestaurantEntity
import com.myongsik.data.model.restaurant.toRequestScrapData
import com.myongsik.data.model.restaurant.toResponseScrapEntity
import com.myongsik.domain.model.restaurant.RequestScrapEntity
import com.myongsik.domain.model.restaurant.ResponseScrapEntity
import com.myongsik.domain.model.restaurant.RestaurantEntity
import com.myongsik.myongsikandroid.util.Constant
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
Expand Down Expand Up @@ -46,8 +45,7 @@ class RestaurantDataSourceImpl @Inject constructor(
maxSize = Constant.PAGING_SIZE * 3
),
pagingSourceFactory = pagingSourceFactory
).flow
.map { pagingData -> pagingData.map { it.toRestaurantEntity() } }
).flow.map { pagingData -> pagingData.map { it.toRestaurantEntity() } }
}

override suspend fun getLoveListRestaurant(): Flow<List<RestaurantEntity>> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.myongsik.data.datasource.user

import com.myongsik.myongsikandroid.domain.model.user.RequestUserEntity
import com.myongsik.myongsikandroid.domain.model.user.ResponseUserEntity
import com.myongsik.domain.model.user.RequestUserEntity
import com.myongsik.domain.model.user.ResponseUserEntity


interface UserDataSource {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.myongsik.data.datasource.user

import com.myongsik.myongsikandroid.data.api.UserApi
import com.myongsik.myongsikandroid.data.model.user.toRequestUserData
import com.myongsik.myongsikandroid.data.model.user.toResponseUserEntity
import com.myongsik.myongsikandroid.domain.model.user.RequestUserEntity
import com.myongsik.myongsikandroid.domain.model.user.ResponseUserEntity
import com.myongsik.data.api.UserApi
import com.myongsik.data.model.user.toRequestUserData
import com.myongsik.data.model.user.toResponseUserEntity
import com.myongsik.domain.model.user.RequestUserEntity
import com.myongsik.domain.model.user.ResponseUserEntity
import javax.inject.Inject

class UserDataSourceImpl @Inject constructor(
Expand Down
2 changes: 1 addition & 1 deletion data/src/main/java/com/myongsik/data/db/RestaurantDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.myongsik.data.db

import androidx.paging.PagingSource
import androidx.room.*
import com.myongsik.myongsikandroid.data.model.kakao.Restaurant
import com.myongsik.data.model.kakao.Restaurant
import kotlinx.coroutines.flow.Flow

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.myongsik.data.db

import androidx.room.Database
import androidx.room.RoomDatabase
import com.myongsik.myongsikandroid.data.model.kakao.Restaurant
import com.myongsik.data.model.kakao.Restaurant

@Database(
entities = [Restaurant::class],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.myongsik.data.model.food

import com.myongsik.myongsikandroid.domain.model.food.ResponseWeekFoodEntity
import com.myongsik.domain.model.food.ResponseWeekFoodEntity


data class WeekFoodResponse(
val success : Boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package com.myongsik.data.model.kakao
import android.os.Parcelable
import androidx.room.Entity
import androidx.room.PrimaryKey
import com.myongsik.myongsikandroid.domain.model.restaurant.RestaurantEntity
import com.myongsik.domain.model.restaurant.RestaurantEntity
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import kotlinx.parcelize.Parcelize
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.myongsik.data.model.kakao


import com.myongsik.myongsikandroid.data.model.food.GetRankRestaurant
import com.myongsik.data.model.food.GetRankRestaurant
import com.squareup.moshi.JsonClass

@JsonClass(generateAdapter = true)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.myongsik.data.model.restaurant

import com.myongsik.myongsikandroid.domain.model.restaurant.RequestScrapEntity
import com.myongsik.domain.model.restaurant.RequestScrapEntity

data class RequestScrap(
val address : String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.myongsik.data.model.restaurant

import com.myongsik.myongsikandroid.domain.model.restaurant.ResponseScrapEntity
import com.myongsik.domain.model.restaurant.ResponseScrapEntity

data class ResponseScrap(
val httpCode : Int,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.myongsik.data.model.review

import com.myongsik.myongsikandroid.domain.model.food.RequestReviewDataEntity
import com.myongsik.domain.model.food.RequestReviewDataEntity


data class RequestReviewData(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.myongsik.data.model.review

import com.myongsik.myongsikandroid.domain.model.food.ResponseReviewDataEntity
import com.myongsik.domain.model.food.ResponseReviewDataEntity

data class ResponseReviewData(
val httpCode: Int,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.myongsik.data.model.user

import com.myongsik.myongsikandroid.domain.model.user.RequestUserEntity
import com.myongsik.domain.model.user.RequestUserEntity


data class RequestUserData(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
package com.myongsik.data.repository.food

import androidx.datastore.preferences.core.Preferences
import com.myongsik.myongsikandroid.base.ApiResponse
import com.myongsik.myongsikandroid.data.model.food.DayFoodResponse
import com.myongsik.myongsikandroid.data.model.food.RankRestaurantResponse
import com.myongsik.myongsikandroid.data.model.food.ResponseOneRestaurant
import com.myongsik.myongsikandroid.data.model.food.WeekFoodResponse
import com.myongsik.myongsikandroid.data.model.review.RequestReviewData
import com.myongsik.myongsikandroid.data.model.review.ResponseReviewData
import com.myongsik.data.model.food.DayFoodResponse
import com.myongsik.data.model.food.RankRestaurantResponse
import com.myongsik.data.model.food.ResponseOneRestaurant
import kotlinx.coroutines.flow.Flow
import retrofit2.Response

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@ import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.core.edit
import androidx.datastore.preferences.core.emptyPreferences
import com.myongsik.myongsikandroid.base.ApiResponse
import com.myongsik.myongsikandroid.base.safeApiCall
import com.myongsik.data.api.HomeFoodApi
import com.myongsik.myongsikandroid.data.model.food.DayFoodResponse
import com.myongsik.myongsikandroid.data.model.food.RankRestaurantResponse
import com.myongsik.myongsikandroid.data.model.food.ResponseOneRestaurant
import com.myongsik.myongsikandroid.data.model.food.WeekFoodResponse
import com.myongsik.myongsikandroid.data.model.review.RequestReviewData
import com.myongsik.myongsikandroid.data.model.review.ResponseReviewData
import com.myongsik.data.model.food.DayFoodResponse
import com.myongsik.data.model.food.RankRestaurantResponse
import com.myongsik.data.model.food.ResponseOneRestaurant
import com.myongsik.myongsikandroid.util.DataStoreKey
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.catch
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.myongsik.data.repository.food

import android.util.Log
import com.myongsik.myongsikandroid.data.datasource.food.FoodDataSource
import com.myongsik.myongsikandroid.domain.model.food.RequestReviewDataEntity
import com.myongsik.myongsikandroid.domain.model.food.ResponseReviewDataEntity
import com.myongsik.myongsikandroid.domain.model.food.ResponseWeekFoodEntity
import com.myongsik.myongsikandroid.domain.repository.food.FoodV2Repository
import com.myongsik.data.datasource.food.FoodDataSource
import com.myongsik.domain.model.food.RequestReviewDataEntity
import com.myongsik.domain.model.food.ResponseReviewDataEntity
import com.myongsik.domain.model.food.ResponseWeekFoodEntity
import com.myongsik.domain.repository.food.FoodV2Repository
import javax.inject.Inject

class FoodV2RepositoryImpl @Inject constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ package com.myongsik.data.repository.food

import androidx.paging.PagingSource
import androidx.paging.PagingState
import com.myongsik.data.api.SearchFoodApi
import com.myongsik.myongsikandroid.data.model.kakao.Restaurant
import com.myongsik.data.model.kakao.Restaurant
import com.myongsik.myongsikandroid.util.Constant
import com.myongsik.myongsikandroid.util.Constant.PAGING_SIZE
import com.myongsik.myongsikandroid.util.MyongsikApplication
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.myongsik.data.repository.restaurant

import androidx.paging.PagingData
import com.myongsik.myongsikandroid.data.datasource.restaurant.RestaurantDataSource
import com.myongsik.myongsikandroid.domain.model.restaurant.RequestScrapEntity
import com.myongsik.myongsikandroid.domain.model.restaurant.ResponseScrapEntity
import com.myongsik.myongsikandroid.domain.model.restaurant.RestaurantEntity
import com.myongsik.myongsikandroid.domain.repository.restaurant.RestaurantRepository
import com.myongsik.data.datasource.restaurant.RestaurantDataSource
import com.myongsik.domain.model.restaurant.RequestScrapEntity
import com.myongsik.domain.model.restaurant.ResponseScrapEntity
import com.myongsik.domain.model.restaurant.RestaurantEntity
import com.myongsik.domain.repository.restaurant.RestaurantRepository
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.myongsik.data.repository.search

import androidx.paging.PagingData
import com.myongsik.myongsikandroid.data.model.kakao.Restaurant
import com.myongsik.myongsikandroid.data.model.kakao.SearchResponse
import com.myongsik.data.model.kakao.Restaurant
import com.myongsik.data.model.kakao.SearchResponse
import kotlinx.coroutines.flow.Flow
import retrofit2.Response

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ package com.myongsik.data.repository.search
import androidx.paging.Pager
import androidx.paging.PagingConfig
import androidx.paging.PagingData
import com.myongsik.data.api.SearchFoodApi
import com.myongsik.myongsikandroid.data.model.kakao.Restaurant
import com.myongsik.myongsikandroid.data.model.kakao.SearchResponse
import com.myongsik.myongsikandroid.data.repository.food.SearchFoodPagingSource
import com.myongsik.data.model.kakao.Restaurant
import com.myongsik.data.model.kakao.SearchResponse
import com.myongsik.data.repository.food.SearchFoodPagingSource
import com.myongsik.myongsikandroid.util.Constant.PAGING_SIZE
import kotlinx.coroutines.flow.Flow
import retrofit2.Response
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.myongsik.data.repository.user

import com.myongsik.myongsikandroid.data.datasource.user.UserDataSource
import com.myongsik.myongsikandroid.domain.model.user.RequestUserEntity
import com.myongsik.myongsikandroid.domain.model.user.ResponseUserEntity
import com.myongsik.myongsikandroid.domain.repository.user.UserRepository
import com.myongsik.data.datasource.user.UserDataSource
import com.myongsik.domain.model.user.RequestUserEntity
import com.myongsik.domain.model.user.ResponseUserEntity
import com.myongsik.domain.repository.user.UserRepository
import javax.inject.Inject

class UserRepositoryImpl @Inject constructor(
Expand Down

0 comments on commit 0c4d6de

Please sign in to comment.