-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refactor] : #83 찜꽁리스트 Room 부분 클린아키텍처 마이그레이션 완료
- Loading branch information
Showing
13 changed files
with
79 additions
and
47 deletions.
There are no files selected for viewing
8 changes: 6 additions & 2 deletions
8
...main/java/com/myongsik/myongsikandroid/data/datasource/restaurant/RestaurantDataSource.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,8 +1,12 @@ | ||
package com.myongsik.myongsikandroid.data.datasource.restaurant | ||
|
||
import com.myongsik.myongsikandroid.domain.model.restaurant.InsertRestaurantEntity | ||
import com.myongsik.myongsikandroid.domain.model.restaurant.RestaurantEntity | ||
|
||
interface RestaurantDataSource { | ||
|
||
suspend fun insertRestaurant(insertRestaurantEntity: InsertRestaurantEntity) | ||
suspend fun insertRestaurant(restaurantEntity: RestaurantEntity) | ||
|
||
suspend fun deleteRestaurant(restaurantEntity: RestaurantEntity) | ||
|
||
suspend fun loveIs(id: String): RestaurantEntity | ||
} |
16 changes: 12 additions & 4 deletions
16
.../java/com/myongsik/myongsikandroid/data/datasource/restaurant/RestaurantDataSourceImpl.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,15 +1,23 @@ | ||
package com.myongsik.myongsikandroid.data.datasource.restaurant | ||
|
||
import com.myongsik.myongsikandroid.data.db.RestaurantDatabase | ||
import com.myongsik.myongsikandroid.data.model.kakao.toInsertFoodData | ||
import com.myongsik.myongsikandroid.domain.model.restaurant.InsertRestaurantEntity | ||
import com.myongsik.myongsikandroid.data.model.kakao.toRestaurantData | ||
import com.myongsik.myongsikandroid.data.model.kakao.toRestaurantEntity | ||
import com.myongsik.myongsikandroid.domain.model.restaurant.RestaurantEntity | ||
import javax.inject.Inject | ||
|
||
class RestaurantDataSourceImpl @Inject constructor( | ||
private val loveDb : RestaurantDatabase | ||
) : RestaurantDataSource { | ||
|
||
override suspend fun insertRestaurant(insertRestaurantEntity: InsertRestaurantEntity) { | ||
loveDb.restaurantDao().insertGoodFood(insertRestaurantEntity.toInsertFoodData()) | ||
override suspend fun insertRestaurant(restaurantEntity: RestaurantEntity) { | ||
loveDb.restaurantDao().insertGoodFood(restaurantEntity.toRestaurantData()) | ||
} | ||
|
||
override suspend fun deleteRestaurant(restaurantEntity: RestaurantEntity) { | ||
loveDb.restaurantDao().deleteBook(restaurantEntity.toRestaurantData()) | ||
} | ||
|
||
override suspend fun loveIs(id: String): RestaurantEntity = loveDb.restaurantDao().loveIs(id).toRestaurantEntity() | ||
|
||
} |
3 changes: 0 additions & 3 deletions
3
app/src/main/java/com/myongsik/myongsikandroid/data/datasource/user/UserDataSourceImpl.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
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
15 changes: 10 additions & 5 deletions
15
.../java/com/myongsik/myongsikandroid/data/repository/restaurant/RestaurantRepositoryImpl.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,17 +1,22 @@ | ||
package com.myongsik.myongsikandroid.data.repository.restaurant | ||
|
||
import com.myongsik.myongsikandroid.data.datasource.restaurant.RestaurantDataSource | ||
import com.myongsik.myongsikandroid.data.db.RestaurantDatabase | ||
import com.myongsik.myongsikandroid.data.model.kakao.toInsertFoodData | ||
import com.myongsik.myongsikandroid.domain.model.restaurant.InsertRestaurantEntity | ||
import com.myongsik.myongsikandroid.domain.model.restaurant.RestaurantEntity | ||
import com.myongsik.myongsikandroid.domain.repository.restaurant.RestaurantRepository | ||
import javax.inject.Inject | ||
|
||
class RestaurantRepositoryImpl @Inject constructor( | ||
private val restaurantDataSource: RestaurantDataSource | ||
) : RestaurantRepository { | ||
|
||
override suspend fun insertRestaurant(insertRestaurantEntity: InsertRestaurantEntity) { | ||
restaurantDataSource.insertRestaurant(insertRestaurantEntity) | ||
override suspend fun insertRestaurant(restaurantEntity: RestaurantEntity) { | ||
restaurantDataSource.insertRestaurant(restaurantEntity) | ||
} | ||
|
||
override suspend fun deleteRestaurant(restaurantEntity: RestaurantEntity) { | ||
restaurantDataSource.deleteRestaurant(restaurantEntity) | ||
} | ||
|
||
override suspend fun loveIs(id: String): RestaurantEntity = restaurantDataSource.loveIs(id) | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...odel/restaurant/InsertRestaurantEntity.kt → ...main/model/restaurant/RestaurantEntity.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
8 changes: 6 additions & 2 deletions
8
...in/java/com/myongsik/myongsikandroid/domain/repository/restaurant/RestaurantRepository.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,8 +1,12 @@ | ||
package com.myongsik.myongsikandroid.domain.repository.restaurant | ||
|
||
import com.myongsik.myongsikandroid.domain.model.restaurant.InsertRestaurantEntity | ||
import com.myongsik.myongsikandroid.domain.model.restaurant.RestaurantEntity | ||
|
||
interface RestaurantRepository { | ||
|
||
suspend fun insertRestaurant(insertRestaurantEntity: InsertRestaurantEntity) | ||
suspend fun insertRestaurant(restaurantEntity: RestaurantEntity) | ||
|
||
suspend fun deleteRestaurant(restaurantEntity: RestaurantEntity) | ||
|
||
suspend fun loveIs(id : String) : RestaurantEntity | ||
} |
13 changes: 13 additions & 0 deletions
13
...ava/com/myongsik/myongsikandroid/domain/usecase/restaurant/DeleteRestaurantDataUseCase.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.myongsik.myongsikandroid.domain.usecase.restaurant | ||
|
||
import com.myongsik.myongsikandroid.domain.repository.restaurant.RestaurantRepository | ||
import com.myongsik.myongsikandroid.domain.model.restaurant.RestaurantEntity | ||
import javax.inject.Inject | ||
|
||
class DeleteRestaurantDataUseCase @Inject constructor( | ||
private val restaurantRepository : RestaurantRepository | ||
) { | ||
|
||
suspend operator fun invoke(restaurantEntity: RestaurantEntity) = | ||
restaurantRepository.deleteRestaurant(restaurantEntity) | ||
} |
6 changes: 3 additions & 3 deletions
6
...ava/com/myongsik/myongsikandroid/domain/usecase/restaurant/InsertRestaurantDataUseCase.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,13 +1,13 @@ | ||
package com.myongsik.myongsikandroid.domain.usecase.restaurant | ||
|
||
import com.myongsik.myongsikandroid.domain.repository.restaurant.RestaurantRepository | ||
import com.myongsik.myongsikandroid.domain.model.restaurant.InsertRestaurantEntity | ||
import com.myongsik.myongsikandroid.domain.model.restaurant.RestaurantEntity | ||
import javax.inject.Inject | ||
|
||
class InsertRestaurantDataUseCase @Inject constructor( | ||
private val restaurantRepository : RestaurantRepository | ||
) { | ||
|
||
suspend operator fun invoke(insertRestaurantEntity: InsertRestaurantEntity) = | ||
restaurantRepository.insertRestaurant(insertRestaurantEntity) | ||
suspend operator fun invoke(restaurantEntity: RestaurantEntity) = | ||
restaurantRepository.insertRestaurant(restaurantEntity) | ||
} |
11 changes: 11 additions & 0 deletions
11
...ava/com/myongsik/myongsikandroid/domain/usecase/restaurant/LoveIsRestaurantDataUseCase.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.myongsik.myongsikandroid.domain.usecase.restaurant | ||
|
||
import com.myongsik.myongsikandroid.domain.repository.restaurant.RestaurantRepository | ||
import javax.inject.Inject | ||
|
||
class LoveIsRestaurantDataUseCase @Inject constructor( | ||
private val restaurantRepository : RestaurantRepository | ||
) { | ||
|
||
suspend operator fun invoke(id : String) = restaurantRepository.loveIs(id) | ||
} |
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