From 0cabd33357e7c5bac8f71a2d3ad0b4c3a210805e Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sat, 3 Aug 2024 21:37:46 +0700 Subject: [PATCH 01/38] Extract model to core --- .../hieuwu/groceriesstore/presentation/account/AccountScreen.kt | 2 +- .../groceriesstore/presentation/account/AccountViewModel.kt | 2 +- .../presentation/account/widgets/AccountContentView.kt | 2 +- .../presentation/account/widgets/AccountHeaderView.kt | 2 +- .../presentation/checkout/composables/CardDetailList.kt | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/AccountScreen.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/AccountScreen.kt index c92d2006..f1ca3b6a 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/AccountScreen.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/AccountScreen.kt @@ -11,7 +11,7 @@ import androidx.compose.ui.res.dimensionResource import androidx.compose.ui.tooling.preview.Preview import androidx.hilt.navigation.compose.hiltViewModel import com.hieuwu.groceriesstore.R -import com.hieuwu.groceriesstore.domain.models.UserModel +import com.hieuwu.groceriesstore.core.models.UserModel import com.hieuwu.groceriesstore.presentation.account.widgets.AccountContentView import com.hieuwu.groceriesstore.presentation.account.widgets.AccountHeaderView diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/AccountViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/AccountViewModel.kt index 14df78b1..ecca464d 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/AccountViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/AccountViewModel.kt @@ -2,7 +2,7 @@ package com.hieuwu.groceriesstore.presentation.account import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hieuwu.groceriesstore.domain.models.UserModel +import com.hieuwu.groceriesstore.core.models.UserModel import com.hieuwu.groceriesstore.domain.usecases.GetProfileUseCase import com.hieuwu.groceriesstore.domain.usecases.SignOutUseCase import dagger.hilt.android.lifecycle.HiltViewModel diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/widgets/AccountContentView.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/widgets/AccountContentView.kt index 7e12510e..f0f9152f 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/widgets/AccountContentView.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/widgets/AccountContentView.kt @@ -19,7 +19,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.tooling.preview.Preview import com.hieuwu.groceriesstore.R -import com.hieuwu.groceriesstore.domain.models.UserModel +import com.hieuwu.groceriesstore.core.models.UserModel import com.hieuwu.groceriesstore.presentation.account.DemoUser import com.hieuwu.groceriesstore.presentation.core.widgets.PrimaryButton import com.hieuwu.groceriesstore.presentation.core.widgets.SecondaryButton diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/widgets/AccountHeaderView.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/widgets/AccountHeaderView.kt index 857e87f3..22a4a14c 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/widgets/AccountHeaderView.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/widgets/AccountHeaderView.kt @@ -22,7 +22,7 @@ import com.airbnb.lottie.compose.LottieCompositionSpec import com.airbnb.lottie.compose.LottieConstants import com.airbnb.lottie.compose.rememberLottieComposition import com.hieuwu.groceriesstore.R -import com.hieuwu.groceriesstore.domain.models.UserModel +import com.hieuwu.groceriesstore.core.models.UserModel import com.hieuwu.groceriesstore.presentation.account.DemoUser import com.hieuwu.groceriesstore.presentation.utils.Converter import com.hieuwu.groceriesstore.presentation.utils.textUnit diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/composables/CardDetailList.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/composables/CardDetailList.kt index bb46e48b..2d84033a 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/composables/CardDetailList.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/composables/CardDetailList.kt @@ -6,7 +6,7 @@ import androidx.compose.foundation.lazy.items import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import com.hieuwu.groceriesstore.domain.models.LineItemModel +import com.hieuwu.groceriesstore.core.models.LineItemModel import com.hieuwu.groceriesstore.presentation.checkout.composables.CartItem @Composable From 3e65eee0ba67d93f6100da94c1ef9e3ad34e13bf Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sat, 3 Aug 2024 21:38:03 +0700 Subject: [PATCH 02/38] Extract model to core --- .../domain/usecases/impl/GetCategoriesListUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/GetCurrentCartUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/GetProductDetailUseCaseImplTest.kt | 2 +- .../usecases/impl/GetProductsByCategoryUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/GetProductsListUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/GetProfileUseCaseImplTest.kt | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImplTest.kt index 811e1fd8..c38f5b84 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImplTest.kt @@ -1,7 +1,7 @@ package com.hieuwu.groceriesstore.domain.usecases.impl import com.hieuwu.groceriesstore.data.repository.CategoryRepository -import com.hieuwu.groceriesstore.domain.models.CategoryModel +import com.hieuwu.groceriesstore.core.models.CategoryModel import com.hieuwu.groceriesstore.domain.usecases.GetCategoriesListUseCase import junit.framework.TestCase.assertEquals import kotlinx.coroutines.flow.flow diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImplTest.kt index be0d52ad..dd2995d3 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImplTest.kt @@ -1,7 +1,7 @@ package com.hieuwu.groceriesstore.domain.usecases.impl import com.hieuwu.groceriesstore.data.repository.OrderRepository -import com.hieuwu.groceriesstore.domain.models.OrderModel +import com.hieuwu.groceriesstore.core.models.OrderModel import com.hieuwu.groceriesstore.domain.usecases.GetCurrentCartUseCase import com.hieuwu.groceriesstore.utilities.OrderStatus import junit.framework.TestCase.assertEquals diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImplTest.kt index da90c3bc..e30525a7 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImplTest.kt @@ -1,7 +1,7 @@ package com.hieuwu.groceriesstore.domain.usecases.impl import com.hieuwu.groceriesstore.data.repository.ProductRepository -import com.hieuwu.groceriesstore.domain.models.ProductModel +import com.hieuwu.groceriesstore.core.models.ProductModel import com.hieuwu.groceriesstore.domain.usecases.GetProductDetailUseCase import junit.framework.TestCase import kotlinx.coroutines.flow.flow diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImplTest.kt index 44929489..5794605e 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImplTest.kt @@ -1,7 +1,7 @@ package com.hieuwu.groceriesstore.domain.usecases.impl import com.hieuwu.groceriesstore.data.repository.ProductRepository -import com.hieuwu.groceriesstore.domain.models.ProductModel +import com.hieuwu.groceriesstore.core.models.ProductModel import com.hieuwu.groceriesstore.domain.usecases.GetProductsByCategoryUseCase import junit.framework.TestCase import kotlinx.coroutines.flow.flow diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImplTest.kt index e4816763..7c270bb7 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImplTest.kt @@ -1,7 +1,7 @@ package com.hieuwu.groceriesstore.domain.usecases.impl import com.hieuwu.groceriesstore.data.repository.ProductRepository -import com.hieuwu.groceriesstore.domain.models.ProductModel +import com.hieuwu.groceriesstore.core.models.ProductModel import com.hieuwu.groceriesstore.domain.usecases.GetProductsListUseCase import junit.framework.TestCase.assertEquals import kotlinx.coroutines.flow.flow diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImplTest.kt index 7fc3c0f5..af64641e 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImplTest.kt @@ -1,7 +1,7 @@ package com.hieuwu.groceriesstore.domain.usecases.impl import com.hieuwu.groceriesstore.data.repository.UserRepository -import com.hieuwu.groceriesstore.domain.models.UserModel +import com.hieuwu.groceriesstore.core.models.UserModel import com.hieuwu.groceriesstore.domain.usecases.GetProfileUseCase import junit.framework.TestCase.assertEquals import junit.framework.TestCase.assertNotNull From ea2f0bef410b7045acca1eb4c80113f34d39e5ef Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sat, 3 Aug 2024 21:38:15 +0700 Subject: [PATCH 03/38] Extract model to core --- .../{domain => core}/models/CategoryModel.kt | 14 +++++++------- .../data/database/entities/Category.kt | 2 +- .../presentation/cart/composables/CartItem.kt | 2 +- .../presentation/checkout/composables/CartItem.kt | 2 +- .../explore/composables/CategoryItem.kt | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) rename app/src/main/java/com/hieuwu/groceriesstore/{domain => core}/models/CategoryModel.kt (66%) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/models/CategoryModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/core/models/CategoryModel.kt similarity index 66% rename from app/src/main/java/com/hieuwu/groceriesstore/domain/models/CategoryModel.kt rename to app/src/main/java/com/hieuwu/groceriesstore/core/models/CategoryModel.kt index a0d346fe..8c651ae0 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/models/CategoryModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/core/models/CategoryModel.kt @@ -1,7 +1,7 @@ -package com.hieuwu.groceriesstore.domain.models - -data class CategoryModel( - var id: String, - var name: String? = null, - var image: String? = null -) +package com.hieuwu.groceriesstore.core.models + +data class CategoryModel( + var id: String, + var name: String? = null, + var image: String? = null +) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Category.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Category.kt index 4f64b44e..f16bc9fe 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Category.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Category.kt @@ -4,7 +4,7 @@ import androidx.annotation.NonNull import androidx.room.ColumnInfo import androidx.room.Entity import androidx.room.PrimaryKey -import com.hieuwu.groceriesstore.domain.models.CategoryModel +import com.hieuwu.groceriesstore.core.models.CategoryModel import com.hieuwu.groceriesstore.utilities.CATEGORY_TABLE @Entity(tableName = CATEGORY_TABLE) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/cart/composables/CartItem.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/cart/composables/CartItem.kt index f9375c76..9c600ce4 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/cart/composables/CartItem.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/cart/composables/CartItem.kt @@ -27,7 +27,7 @@ import androidx.compose.ui.unit.dp import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi import com.bumptech.glide.integration.compose.GlideImage import com.hieuwu.groceriesstore.R -import com.hieuwu.groceriesstore.domain.models.LineItemModel +import com.hieuwu.groceriesstore.core.models.LineItemModel @OptIn(ExperimentalGlideComposeApi::class) @Composable diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/composables/CartItem.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/composables/CartItem.kt index bcc69985..e4ca76cc 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/composables/CartItem.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/composables/CartItem.kt @@ -31,7 +31,7 @@ import androidx.compose.ui.unit.sp import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi import com.bumptech.glide.integration.compose.GlideImage import com.hieuwu.groceriesstore.R -import com.hieuwu.groceriesstore.domain.models.LineItemModel +import com.hieuwu.groceriesstore.core.models.LineItemModel @OptIn(ExperimentalGlideComposeApi::class) @Composable diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/composables/CategoryItem.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/composables/CategoryItem.kt index 3796623a..bb5d917c 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/composables/CategoryItem.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/composables/CategoryItem.kt @@ -20,7 +20,7 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi import com.bumptech.glide.integration.compose.GlideImage -import com.hieuwu.groceriesstore.domain.models.CategoryModel +import com.hieuwu.groceriesstore.core.models.CategoryModel @OptIn( ExperimentalGlideComposeApi::class, From 3d5c582f785dcf690b60e32f367ecb6d74e6f935 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sat, 3 Aug 2024 21:38:22 +0700 Subject: [PATCH 04/38] Extract model to core --- .../groceriesstore/data/repository/CategoryRepository.kt | 2 +- .../hieuwu/groceriesstore/presentation/cart/CartViewModel.kt | 4 ++-- .../groceriesstore/presentation/checkout/CheckOutViewModel.kt | 4 ++-- .../groceriesstore/presentation/explore/ExploreScreen.kt | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/CategoryRepository.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/CategoryRepository.kt index 0403f1e4..206fddab 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/CategoryRepository.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/CategoryRepository.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.data.repository -import com.hieuwu.groceriesstore.domain.models.CategoryModel +import com.hieuwu.groceriesstore.core.models.CategoryModel import kotlinx.coroutines.flow.Flow interface CategoryRepository { diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/cart/CartViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/cart/CartViewModel.kt index 60ad3735..318a78a4 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/cart/CartViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/cart/CartViewModel.kt @@ -2,8 +2,8 @@ package com.hieuwu.groceriesstore.presentation.cart import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hieuwu.groceriesstore.domain.models.LineItemModel -import com.hieuwu.groceriesstore.domain.models.OrderModel +import com.hieuwu.groceriesstore.core.models.LineItemModel +import com.hieuwu.groceriesstore.core.models.OrderModel import com.hieuwu.groceriesstore.domain.usecases.UpdateCartItemUseCase import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.SharingStarted diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/CheckOutViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/CheckOutViewModel.kt index 27d2544f..9912df5d 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/CheckOutViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/CheckOutViewModel.kt @@ -2,8 +2,8 @@ package com.hieuwu.groceriesstore.presentation.checkout import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hieuwu.groceriesstore.domain.models.OrderModel -import com.hieuwu.groceriesstore.domain.models.UserModel +import com.hieuwu.groceriesstore.core.models.OrderModel +import com.hieuwu.groceriesstore.core.models.UserModel import com.hieuwu.groceriesstore.domain.usecases.GetCurrentCartUseCase import com.hieuwu.groceriesstore.domain.usecases.GetProfileUseCase import com.hieuwu.groceriesstore.domain.usecases.SubmitOrderUseCase diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreScreen.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreScreen.kt index 02d77ac8..84e13a97 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreScreen.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreScreen.kt @@ -46,8 +46,8 @@ import com.airbnb.lottie.compose.LottieCompositionSpec import com.airbnb.lottie.compose.LottieConstants import com.airbnb.lottie.compose.rememberLottieComposition import com.hieuwu.groceriesstore.R -import com.hieuwu.groceriesstore.domain.models.CategoryModel -import com.hieuwu.groceriesstore.domain.models.ProductModel +import com.hieuwu.groceriesstore.core.models.CategoryModel +import com.hieuwu.groceriesstore.core.models.ProductModel import com.hieuwu.groceriesstore.presentation.explore.composables.CategoryItem import com.hieuwu.groceriesstore.presentation.explore.composables.ProductItem import kotlinx.coroutines.launch From 508ae87e1e116991d85c5fdc48dfe7e864252207 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sat, 3 Aug 2024 21:38:32 +0700 Subject: [PATCH 05/38] Extract model to core --- .../{domain => core}/models/LineItemModel.kt | 40 ++++++++--------- .../{domain => core}/models/MealModel.kt | 2 +- .../{domain => core}/models/OrderModel.kt | 44 +++++++++---------- .../{domain => core}/models/ProductModel.kt | 20 ++++----- .../{domain => core}/models/RecipeModel.kt | 14 +++--- .../{domain => core}/models/UserModel.kt | 22 +++++----- .../database/entities/OrderWithLineItems.kt | 2 +- .../data/database/entities/Product.kt | 2 +- .../database/entities/ProductAndLineItem.kt | 2 +- .../data/database/entities/Recipe.kt | 2 +- .../data/database/entities/User.kt | 2 +- .../data/repository/MealPlanRepository.kt | 2 +- .../data/repository/OrderRepository.kt | 2 +- .../data/repository/ProductRepository.kt | 2 +- .../data/repository/RecipeRepository.kt | 2 +- .../data/repository/UserRepository.kt | 2 +- .../repository/impl/MealPlanRepositoryImpl.kt | 2 +- .../repository/impl/OrderRepositoryImpl.kt | 4 +- .../repository/impl/ProductRepositoryImpl.kt | 2 +- .../usecases/GetCategoriesListUseCase.kt | 2 +- .../domain/usecases/GetCurrentCartUseCase.kt | 2 +- .../domain/usecases/GetOrderListUseCase.kt | 2 +- .../usecases/GetProductDetailUseCase.kt | 2 +- .../usecases/GetProductsByCategoryUseCase.kt | 2 +- .../domain/usecases/GetProductsListUseCase.kt | 2 +- .../domain/usecases/GetProfileUseCase.kt | 2 +- .../usecases/RetrieveMealByTypeUseCase.kt | 2 +- .../domain/usecases/SearchProductUseCase.kt | 2 +- .../domain/usecases/SubmitOrderUseCase.kt | 2 +- .../domain/usecases/UpdateCartItemUseCase.kt | 4 +- .../impl/RetrieveMealByTypeUseCaseImpl.kt | 2 +- .../impl/UpdateCartItemUseCaseImpl.kt | 4 +- .../presentation/explore/ExploreViewModel.kt | 6 +-- .../explore/composables/ProductItem.kt | 2 +- .../favourite/FavouriteViewModel.kt | 2 +- .../favourite/composables/RecipeItem.kt | 2 +- .../overview/OverviewViewModel.kt | 2 +- .../NotificationSettingsViewModel.kt | 2 +- .../orderhistory/OrderListViewModel.kt | 2 +- .../productdetail/ProductDetailViewModel.kt | 2 +- .../productlist/ProductListScreen.kt | 2 +- .../productlist/ProductListViewModel.kt | 4 +- .../productlist/ProductListViewState.kt | 2 +- .../presentation/shop/ShopViewModel.kt | 4 +- .../shop/composables/ProductCatalogue.kt | 2 +- .../shop/composables/ProductItem.kt | 2 +- .../updateprofile/UpdateProfileScreen.kt | 2 +- .../updateprofile/UpdateProfileViewModel.kt | 2 +- .../widgets/UpdateProfileScreenContent.kt | 2 +- .../impl/SearchProductUseCaseImplTest.kt | 2 +- .../impl/SubmitOrderUseCaseImplTest.kt | 2 +- .../impl/UpdateCartItemUseCaseImplTest.kt | 4 +- 52 files changed, 125 insertions(+), 125 deletions(-) rename app/src/main/java/com/hieuwu/groceriesstore/{domain => core}/models/LineItemModel.kt (87%) rename app/src/main/java/com/hieuwu/groceriesstore/{domain => core}/models/MealModel.kt (81%) rename app/src/main/java/com/hieuwu/groceriesstore/{domain => core}/models/OrderModel.kt (87%) rename app/src/main/java/com/hieuwu/groceriesstore/{domain => core}/models/ProductModel.kt (78%) rename app/src/main/java/com/hieuwu/groceriesstore/{domain => core}/models/RecipeModel.kt (62%) rename app/src/main/java/com/hieuwu/groceriesstore/{domain => core}/models/UserModel.kt (82%) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/models/LineItemModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/core/models/LineItemModel.kt similarity index 87% rename from app/src/main/java/com/hieuwu/groceriesstore/domain/models/LineItemModel.kt rename to app/src/main/java/com/hieuwu/groceriesstore/core/models/LineItemModel.kt index f1d3db7e..e8569e5f 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/models/LineItemModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/core/models/LineItemModel.kt @@ -1,20 +1,20 @@ -package com.hieuwu.groceriesstore.domain.models - -data class LineItemModel( - var id: Long? = null, - var name: String? = null, - var price: Double? = null, - var image: String? = null, - var productId: String? = null, - var quantity: Int? = null, - var subtotal: Double? = quantity?.let { price?.times(it) } -) { - fun increaseQuantity() { - quantity = quantity?.plus(1) - } - - fun decreaseQuantity() { - if (quantity == 1) return - quantity = quantity?.minus(1) - } -} +package com.hieuwu.groceriesstore.core.models + +data class LineItemModel( + var id: Long? = null, + var name: String? = null, + var price: Double? = null, + var image: String? = null, + var productId: String? = null, + var quantity: Int? = null, + var subtotal: Double? = quantity?.let { price?.times(it) } +) { + fun increaseQuantity() { + quantity = quantity?.plus(1) + } + + fun decreaseQuantity() { + if (quantity == 1) return + quantity = quantity?.minus(1) + } +} diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/models/MealModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/core/models/MealModel.kt similarity index 81% rename from app/src/main/java/com/hieuwu/groceriesstore/domain/models/MealModel.kt rename to app/src/main/java/com/hieuwu/groceriesstore/core/models/MealModel.kt index 6034c6a8..b05195ca 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/models/MealModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/core/models/MealModel.kt @@ -1,4 +1,4 @@ -package com.hieuwu.groceriesstore.domain.models +package com.hieuwu.groceriesstore.core.models data class MealModel( val id: String, diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/models/OrderModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/core/models/OrderModel.kt similarity index 87% rename from app/src/main/java/com/hieuwu/groceriesstore/domain/models/OrderModel.kt rename to app/src/main/java/com/hieuwu/groceriesstore/core/models/OrderModel.kt index c13a562d..0f35d224 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/models/OrderModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/core/models/OrderModel.kt @@ -1,22 +1,22 @@ -package com.hieuwu.groceriesstore.domain.models - -data class OrderModel( - var id: String = "", - var status: String? = null, - var address: String? = null, - val lineItemList: MutableList, - val createdAt: String = "", -) { - var totalPrice: Double = 0.0 - val total: Double - get() = calculateTotal() - - private fun calculateTotal(): Double { - var sum = 0.0 - for (item in lineItemList) { - val sub = item.subtotal ?: 0.0 - sum = sum.plus(sub) - } - return sum - } -} +package com.hieuwu.groceriesstore.core.models + +data class OrderModel( + var id: String = "", + var status: String? = null, + var address: String? = null, + val lineItemList: MutableList, + val createdAt: String = "", +) { + var totalPrice: Double = 0.0 + val total: Double + get() = calculateTotal() + + private fun calculateTotal(): Double { + var sum = 0.0 + for (item in lineItemList) { + val sub = item.subtotal ?: 0.0 + sum = sum.plus(sub) + } + return sum + } +} diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/models/ProductModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/core/models/ProductModel.kt similarity index 78% rename from app/src/main/java/com/hieuwu/groceriesstore/domain/models/ProductModel.kt rename to app/src/main/java/com/hieuwu/groceriesstore/core/models/ProductModel.kt index 24127a37..8521a4a0 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/models/ProductModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/core/models/ProductModel.kt @@ -1,10 +1,10 @@ -package com.hieuwu.groceriesstore.domain.models - -data class ProductModel( - var id: String, - var name: String? = null, - var price: Double? = null, - var image: String? = null, - var description: String? = null, - var nutrition: String? = null -) +package com.hieuwu.groceriesstore.core.models + +data class ProductModel( + var id: String, + var name: String? = null, + var price: Double? = null, + var image: String? = null, + var description: String? = null, + var nutrition: String? = null +) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/models/RecipeModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/core/models/RecipeModel.kt similarity index 62% rename from app/src/main/java/com/hieuwu/groceriesstore/domain/models/RecipeModel.kt rename to app/src/main/java/com/hieuwu/groceriesstore/core/models/RecipeModel.kt index abc1f31d..4e3f6a52 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/models/RecipeModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/core/models/RecipeModel.kt @@ -1,7 +1,7 @@ -package com.hieuwu.groceriesstore.domain.models - -data class RecipeModel( - val id: String, - val image: String, - val name: String -) +package com.hieuwu.groceriesstore.core.models + +data class RecipeModel( + val id: String, + val image: String, + val name: String +) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/models/UserModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/core/models/UserModel.kt similarity index 82% rename from app/src/main/java/com/hieuwu/groceriesstore/domain/models/UserModel.kt rename to app/src/main/java/com/hieuwu/groceriesstore/core/models/UserModel.kt index 63c18533..4658a902 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/models/UserModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/core/models/UserModel.kt @@ -1,12 +1,12 @@ -package com.hieuwu.groceriesstore.domain.models - -data class UserModel( - val id: String, - val name: String? = null, - val email: String?, - val phone: String, - val address: String, - var isOrderCreatedNotiEnabled: Boolean, - var isPromotionNotiEnabled: Boolean, - var isDataRefreshedNotiEnabled: Boolean +package com.hieuwu.groceriesstore.core.models + +data class UserModel( + val id: String, + val name: String? = null, + val email: String?, + val phone: String, + val address: String, + var isOrderCreatedNotiEnabled: Boolean, + var isPromotionNotiEnabled: Boolean, + var isDataRefreshedNotiEnabled: Boolean ) \ No newline at end of file diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/OrderWithLineItems.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/OrderWithLineItems.kt index dd38591f..940e8a8d 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/OrderWithLineItems.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/OrderWithLineItems.kt @@ -2,7 +2,7 @@ package com.hieuwu.groceriesstore.data.database.entities import androidx.room.Embedded import androidx.room.Relation -import com.hieuwu.groceriesstore.domain.models.OrderModel +import com.hieuwu.groceriesstore.core.models.OrderModel data class OrderWithLineItems( @Embedded var order: Order, diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Product.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Product.kt index 7aec336a..2a88f636 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Product.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Product.kt @@ -4,7 +4,7 @@ import androidx.annotation.NonNull import androidx.room.ColumnInfo import androidx.room.Entity import androidx.room.PrimaryKey -import com.hieuwu.groceriesstore.domain.models.ProductModel +import com.hieuwu.groceriesstore.core.models.ProductModel import com.hieuwu.groceriesstore.utilities.PRODUCT_TABLE @Entity(tableName = PRODUCT_TABLE) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/ProductAndLineItem.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/ProductAndLineItem.kt index c556de08..b44be792 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/ProductAndLineItem.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/ProductAndLineItem.kt @@ -2,7 +2,7 @@ package com.hieuwu.groceriesstore.data.database.entities import androidx.room.Embedded import androidx.room.Relation -import com.hieuwu.groceriesstore.domain.models.LineItemModel +import com.hieuwu.groceriesstore.core.models.LineItemModel data class ProductAndLineItem( @Embedded val lineItem: LineItem?, diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Recipe.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Recipe.kt index 6c1d6a94..9eb43861 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Recipe.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Recipe.kt @@ -3,7 +3,7 @@ package com.hieuwu.groceriesstore.data.database.entities import androidx.room.ColumnInfo import androidx.room.Entity import androidx.room.PrimaryKey -import com.hieuwu.groceriesstore.domain.models.RecipeModel +import com.hieuwu.groceriesstore.core.models.RecipeModel import com.hieuwu.groceriesstore.utilities.RECIPE_TABLE @Entity(tableName = RECIPE_TABLE) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/User.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/User.kt index b3f06b50..89209c24 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/User.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/User.kt @@ -3,7 +3,7 @@ package com.hieuwu.groceriesstore.data.database.entities import androidx.room.ColumnInfo import androidx.room.Entity import androidx.room.PrimaryKey -import com.hieuwu.groceriesstore.domain.models.UserModel +import com.hieuwu.groceriesstore.core.models.UserModel import com.hieuwu.groceriesstore.utilities.USER_TABLE @Entity(tableName = USER_TABLE) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/MealPlanRepository.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/MealPlanRepository.kt index 9f1b09b7..ca24bdff 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/MealPlanRepository.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/MealPlanRepository.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.data.repository -import com.hieuwu.groceriesstore.domain.models.MealModel +import com.hieuwu.groceriesstore.core.models.MealModel interface MealPlanRepository { suspend fun addMealToPlan( diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/OrderRepository.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/OrderRepository.kt index 1d6eeeb2..4d559e1d 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/OrderRepository.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/OrderRepository.kt @@ -2,7 +2,7 @@ package com.hieuwu.groceriesstore.data.repository import com.hieuwu.groceriesstore.data.database.entities.LineItem import com.hieuwu.groceriesstore.data.database.entities.Order -import com.hieuwu.groceriesstore.domain.models.OrderModel +import com.hieuwu.groceriesstore.core.models.OrderModel import com.hieuwu.groceriesstore.utilities.OrderStatus import kotlinx.coroutines.flow.Flow diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/ProductRepository.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/ProductRepository.kt index 9dd35e8e..128cb6af 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/ProductRepository.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/ProductRepository.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.data.repository -import com.hieuwu.groceriesstore.domain.models.ProductModel +import com.hieuwu.groceriesstore.core.models.ProductModel import kotlinx.coroutines.flow.Flow interface ProductRepository { diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/RecipeRepository.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/RecipeRepository.kt index 04ffcbe5..2f0a8b50 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/RecipeRepository.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/RecipeRepository.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.data.repository -import com.hieuwu.groceriesstore.domain.models.RecipeModel +import com.hieuwu.groceriesstore.core.models.RecipeModel import kotlinx.coroutines.flow.Flow interface RecipeRepository { diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/UserRepository.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/UserRepository.kt index a4bb9b7a..32517aa4 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/UserRepository.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/UserRepository.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.data.repository -import com.hieuwu.groceriesstore.domain.models.UserModel +import com.hieuwu.groceriesstore.core.models.UserModel import kotlinx.coroutines.flow.Flow interface UserRepository { diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/MealPlanRepositoryImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/MealPlanRepositoryImpl.kt index d42ad78b..35d8cb28 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/MealPlanRepositoryImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/MealPlanRepositoryImpl.kt @@ -3,7 +3,7 @@ package com.hieuwu.groceriesstore.data.repository.impl import com.hieuwu.groceriesstore.data.network.dto.Meal import com.hieuwu.groceriesstore.data.repository.MealPlanRepository import com.hieuwu.groceriesstore.data.repository.UserRepository -import com.hieuwu.groceriesstore.domain.models.MealModel +import com.hieuwu.groceriesstore.core.models.MealModel import com.hieuwu.groceriesstore.utilities.SupabaseHelper import io.github.jan.supabase.postgrest.Postgrest import io.github.jan.supabase.storage.Storage diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/OrderRepositoryImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/OrderRepositoryImpl.kt index 973eaa9b..d152af94 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/OrderRepositoryImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/OrderRepositoryImpl.kt @@ -7,11 +7,11 @@ import com.hieuwu.groceriesstore.data.database.entities.Order import com.hieuwu.groceriesstore.data.database.entities.asDomainModel import com.hieuwu.groceriesstore.data.network.dto.OrderDto import com.hieuwu.groceriesstore.data.repository.OrderRepository -import com.hieuwu.groceriesstore.domain.models.OrderModel +import com.hieuwu.groceriesstore.core.models.OrderModel import com.hieuwu.groceriesstore.utilities.OrderStatus import com.hieuwu.groceriesstore.data.network.RemoteTable import com.hieuwu.groceriesstore.data.network.dto.LineItemDto -import com.hieuwu.groceriesstore.domain.models.LineItemModel +import com.hieuwu.groceriesstore.core.models.LineItemModel import io.github.jan.supabase.postgrest.Postgrest import java.util.Date import kotlinx.coroutines.flow.Flow diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/ProductRepositoryImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/ProductRepositoryImpl.kt index 04b0cb3a..5a8bdca7 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/ProductRepositoryImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/ProductRepositoryImpl.kt @@ -7,7 +7,7 @@ import com.hieuwu.groceriesstore.data.database.entities.asDomainModel import com.hieuwu.groceriesstore.data.network.RemoteTable import com.hieuwu.groceriesstore.data.network.dto.ProductDto import com.hieuwu.groceriesstore.data.repository.ProductRepository -import com.hieuwu.groceriesstore.domain.models.ProductModel +import com.hieuwu.groceriesstore.core.models.ProductModel import io.github.jan.supabase.postgrest.Postgrest import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flow diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetCategoriesListUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetCategoriesListUseCase.kt index 1dc11e76..24d7f43b 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetCategoriesListUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetCategoriesListUseCase.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.domain.models.CategoryModel +import com.hieuwu.groceriesstore.core.models.CategoryModel import kotlinx.coroutines.flow.Flow interface GetCategoriesListUseCase : diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetCurrentCartUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetCurrentCartUseCase.kt index 022aa80e..da968a94 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetCurrentCartUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetCurrentCartUseCase.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.domain.models.OrderModel +import com.hieuwu.groceriesstore.core.models.OrderModel import kotlinx.coroutines.flow.Flow interface GetCurrentCartUseCase : diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetOrderListUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetOrderListUseCase.kt index 234e241a..c9f81a6d 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetOrderListUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetOrderListUseCase.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.domain.models.OrderModel +import com.hieuwu.groceriesstore.core.models.OrderModel interface GetOrderListUseCase : SuspendUseCase { class Input diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductDetailUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductDetailUseCase.kt index e0e1b729..81f1da31 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductDetailUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductDetailUseCase.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.domain.models.ProductModel +import com.hieuwu.groceriesstore.core.models.ProductModel import kotlinx.coroutines.flow.Flow interface GetProductDetailUseCase { diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductsByCategoryUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductsByCategoryUseCase.kt index 1407e938..2ff427b7 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductsByCategoryUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductsByCategoryUseCase.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.domain.models.ProductModel +import com.hieuwu.groceriesstore.core.models.ProductModel import kotlinx.coroutines.flow.Flow interface GetProductsByCategoryUseCase : diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductsListUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductsListUseCase.kt index c7ec6042..06298041 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductsListUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductsListUseCase.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.domain.models.ProductModel +import com.hieuwu.groceriesstore.core.models.ProductModel import kotlinx.coroutines.flow.Flow interface GetProductsListUseCase: UseCase { diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProfileUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProfileUseCase.kt index 88874121..61c68b39 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProfileUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProfileUseCase.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.domain.models.UserModel +import com.hieuwu.groceriesstore.core.models.UserModel import kotlinx.coroutines.flow.Flow interface GetProfileUseCase:SuspendUseCase { diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/RetrieveMealByTypeUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/RetrieveMealByTypeUseCase.kt index 66713c65..8803872c 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/RetrieveMealByTypeUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/RetrieveMealByTypeUseCase.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.domain.models.MealModel +import com.hieuwu.groceriesstore.core.models.MealModel import com.hieuwu.groceriesstore.presentation.mealplanning.overview.state.MealType import com.hieuwu.groceriesstore.presentation.mealplanning.overview.state.WeekDayValue diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/SearchProductUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/SearchProductUseCase.kt index a6c7e108..1ddce46e 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/SearchProductUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/SearchProductUseCase.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.domain.models.ProductModel +import com.hieuwu.groceriesstore.core.models.ProductModel import kotlinx.coroutines.flow.Flow interface SearchProductUseCase : SuspendUseCase { diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/SubmitOrderUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/SubmitOrderUseCase.kt index 1375b004..41709312 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/SubmitOrderUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/SubmitOrderUseCase.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.domain.models.OrderModel +import com.hieuwu.groceriesstore.core.models.OrderModel interface SubmitOrderUseCase : SuspendUseCase { class Input(val order: OrderModel) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/UpdateCartItemUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/UpdateCartItemUseCase.kt index 89408ace..98ae21e2 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/UpdateCartItemUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/UpdateCartItemUseCase.kt @@ -1,7 +1,7 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.domain.models.LineItemModel -import com.hieuwu.groceriesstore.domain.models.OrderModel +import com.hieuwu.groceriesstore.core.models.LineItemModel +import com.hieuwu.groceriesstore.core.models.OrderModel import kotlinx.coroutines.flow.Flow interface UpdateCartItemUseCase { diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RetrieveMealByTypeUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RetrieveMealByTypeUseCaseImpl.kt index c7711351..9d4f3bd2 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RetrieveMealByTypeUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RetrieveMealByTypeUseCaseImpl.kt @@ -2,7 +2,7 @@ package com.hieuwu.groceriesstore.domain.usecases.impl import com.hieuwu.groceriesstore.data.repository.MealPlanRepository import com.hieuwu.groceriesstore.di.IoDispatcher -import com.hieuwu.groceriesstore.domain.models.MealModel +import com.hieuwu.groceriesstore.core.models.MealModel import com.hieuwu.groceriesstore.domain.usecases.RetrieveMealByTypeUseCase import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.first diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImpl.kt index b9a6ec82..ccdb444c 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImpl.kt @@ -3,8 +3,8 @@ package com.hieuwu.groceriesstore.domain.usecases.impl import com.hieuwu.groceriesstore.data.repository.OrderRepository import com.hieuwu.groceriesstore.data.repository.ProductRepository import com.hieuwu.groceriesstore.di.IoDispatcher -import com.hieuwu.groceriesstore.domain.models.LineItemModel -import com.hieuwu.groceriesstore.domain.models.OrderModel +import com.hieuwu.groceriesstore.core.models.LineItemModel +import com.hieuwu.groceriesstore.core.models.OrderModel import com.hieuwu.groceriesstore.domain.usecases.UpdateCartItemUseCase import com.hieuwu.groceriesstore.utilities.OrderStatus import kotlinx.coroutines.CoroutineDispatcher diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreViewModel.kt index 3ce0bb8b..b256d360 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreViewModel.kt @@ -4,9 +4,9 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.hieuwu.groceriesstore.data.database.entities.LineItem import com.hieuwu.groceriesstore.data.database.entities.Order -import com.hieuwu.groceriesstore.domain.models.CategoryModel -import com.hieuwu.groceriesstore.domain.models.OrderModel -import com.hieuwu.groceriesstore.domain.models.ProductModel +import com.hieuwu.groceriesstore.core.models.CategoryModel +import com.hieuwu.groceriesstore.core.models.OrderModel +import com.hieuwu.groceriesstore.core.models.ProductModel import com.hieuwu.groceriesstore.domain.usecases.AddToCartUseCase import com.hieuwu.groceriesstore.domain.usecases.CreateNewOrderUseCase import com.hieuwu.groceriesstore.domain.usecases.GetCategoriesListUseCase diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/composables/ProductItem.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/composables/ProductItem.kt index 94b13967..56a13b42 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/composables/ProductItem.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/composables/ProductItem.kt @@ -29,7 +29,7 @@ import androidx.compose.ui.unit.dp import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi import com.bumptech.glide.integration.compose.GlideImage import com.hieuwu.groceriesstore.R -import com.hieuwu.groceriesstore.domain.models.ProductModel +import com.hieuwu.groceriesstore.core.models.ProductModel @OptIn(ExperimentalGlideComposeApi::class, ExperimentalMaterialApi::class) @Composable diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/FavouriteViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/FavouriteViewModel.kt index 8df2b4f0..5e1e4774 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/FavouriteViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/FavouriteViewModel.kt @@ -6,7 +6,7 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.asLiveData import androidx.lifecycle.viewModelScope import com.hieuwu.groceriesstore.data.repository.RecipeRepository -import com.hieuwu.groceriesstore.domain.models.RecipeModel +import com.hieuwu.groceriesstore.core.models.RecipeModel import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.stateIn diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/composables/RecipeItem.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/composables/RecipeItem.kt index 3a2daef2..1f63f717 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/composables/RecipeItem.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/composables/RecipeItem.kt @@ -14,7 +14,7 @@ import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.unit.dp import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi import com.bumptech.glide.integration.compose.GlideImage -import com.hieuwu.groceriesstore.domain.models.RecipeModel +import com.hieuwu.groceriesstore.core.models.RecipeModel @OptIn(ExperimentalGlideComposeApi::class) @Composable diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/mealplanning/overview/OverviewViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/mealplanning/overview/OverviewViewModel.kt index 844fcf73..853f9d2b 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/mealplanning/overview/OverviewViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/mealplanning/overview/OverviewViewModel.kt @@ -2,7 +2,7 @@ package com.hieuwu.groceriesstore.presentation.mealplanning.overview import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hieuwu.groceriesstore.domain.models.MealModel +import com.hieuwu.groceriesstore.core.models.MealModel import com.hieuwu.groceriesstore.domain.usecases.AddMealToPlanUseCase import com.hieuwu.groceriesstore.domain.usecases.RemoveMealFromPlanUseCase import com.hieuwu.groceriesstore.domain.usecases.RetrieveMealByTypeUseCase diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/notificationsettings/NotificationSettingsViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/notificationsettings/NotificationSettingsViewModel.kt index cd760936..7bdc49a7 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/notificationsettings/NotificationSettingsViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/notificationsettings/NotificationSettingsViewModel.kt @@ -3,7 +3,7 @@ package com.hieuwu.groceriesstore.presentation.notificationsettings import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hieuwu.groceriesstore.domain.models.UserModel +import com.hieuwu.groceriesstore.core.models.UserModel import com.hieuwu.groceriesstore.domain.usecases.GetProfileUseCase import com.hieuwu.groceriesstore.domain.usecases.UserSettingsUseCase import dagger.hilt.android.lifecycle.HiltViewModel diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/orderhistory/OrderListViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/orderhistory/OrderListViewModel.kt index 005c382e..6fa87b89 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/orderhistory/OrderListViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/orderhistory/OrderListViewModel.kt @@ -2,7 +2,7 @@ package com.hieuwu.groceriesstore.presentation.orderhistory import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hieuwu.groceriesstore.domain.models.OrderModel +import com.hieuwu.groceriesstore.core.models.OrderModel import com.hieuwu.groceriesstore.domain.usecases.GetOrderListUseCase import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.MutableStateFlow diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productdetail/ProductDetailViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productdetail/ProductDetailViewModel.kt index 9c7df22d..9e4f7f6a 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productdetail/ProductDetailViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productdetail/ProductDetailViewModel.kt @@ -6,7 +6,7 @@ import androidx.lifecycle.viewModelScope import com.hieuwu.groceriesstore.data.database.entities.LineItem import com.hieuwu.groceriesstore.data.database.entities.Order import com.hieuwu.groceriesstore.data.repository.OrderRepository -import com.hieuwu.groceriesstore.domain.models.OrderModel +import com.hieuwu.groceriesstore.core.models.OrderModel import com.hieuwu.groceriesstore.domain.usecases.GetProductDetailUseCase import com.hieuwu.groceriesstore.utilities.OrderStatus import dagger.hilt.android.lifecycle.HiltViewModel diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListScreen.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListScreen.kt index 4aef43bd..f56d5847 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListScreen.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListScreen.kt @@ -54,7 +54,7 @@ import com.airbnb.lottie.compose.LottieCompositionSpec import com.airbnb.lottie.compose.LottieConstants import com.airbnb.lottie.compose.rememberLottieComposition import com.hieuwu.groceriesstore.R -import com.hieuwu.groceriesstore.domain.models.ProductModel +import com.hieuwu.groceriesstore.core.models.ProductModel import com.hieuwu.groceriesstore.presentation.core.widgets.PrimarySquareIconButton import com.hieuwu.groceriesstore.presentation.core.widgets.WebImage import kotlinx.collections.immutable.ImmutableList diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewModel.kt index 42b08ee1..a67227c2 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewModel.kt @@ -5,8 +5,8 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.hieuwu.groceriesstore.data.database.entities.LineItem import com.hieuwu.groceriesstore.data.database.entities.Order -import com.hieuwu.groceriesstore.domain.models.OrderModel -import com.hieuwu.groceriesstore.domain.models.ProductModel +import com.hieuwu.groceriesstore.core.models.OrderModel +import com.hieuwu.groceriesstore.core.models.ProductModel import com.hieuwu.groceriesstore.domain.usecases.AddToCartUseCase import com.hieuwu.groceriesstore.domain.usecases.CreateNewOrderUseCase import com.hieuwu.groceriesstore.domain.usecases.GetCurrentCartUseCase diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewState.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewState.kt index 18ec9e58..77ab3860 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewState.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewState.kt @@ -1,7 +1,7 @@ package com.hieuwu.groceriesstore.presentation.productlist import androidx.compose.runtime.Immutable -import com.hieuwu.groceriesstore.domain.models.ProductModel +import com.hieuwu.groceriesstore.core.models.ProductModel import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentListOf diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/ShopViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/ShopViewModel.kt index 540c1b26..5896afc5 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/ShopViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/ShopViewModel.kt @@ -4,8 +4,8 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.hieuwu.groceriesstore.data.database.entities.LineItem import com.hieuwu.groceriesstore.data.database.entities.Order -import com.hieuwu.groceriesstore.domain.models.OrderModel -import com.hieuwu.groceriesstore.domain.models.ProductModel +import com.hieuwu.groceriesstore.core.models.OrderModel +import com.hieuwu.groceriesstore.core.models.ProductModel import com.hieuwu.groceriesstore.domain.usecases.AddToCartUseCase import com.hieuwu.groceriesstore.domain.usecases.CreateNewOrderUseCase import com.hieuwu.groceriesstore.domain.usecases.GetCurrentCartUseCase diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/composables/ProductCatalogue.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/composables/ProductCatalogue.kt index a8277dd3..ea7ef7cc 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/composables/ProductCatalogue.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/composables/ProductCatalogue.kt @@ -16,7 +16,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import com.hieuwu.groceriesstore.domain.models.ProductModel +import com.hieuwu.groceriesstore.core.models.ProductModel @Composable fun ProductCatalogue( diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/composables/ProductItem.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/composables/ProductItem.kt index 981baa77..988f7082 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/composables/ProductItem.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/composables/ProductItem.kt @@ -29,7 +29,7 @@ import androidx.compose.ui.unit.dp import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi import com.bumptech.glide.integration.compose.GlideImage import com.hieuwu.groceriesstore.R -import com.hieuwu.groceriesstore.domain.models.ProductModel +import com.hieuwu.groceriesstore.core.models.ProductModel @OptIn(ExperimentalGlideComposeApi::class, ExperimentalMaterialApi::class) @Composable diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/UpdateProfileScreen.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/UpdateProfileScreen.kt index 3c675c97..ca75b870 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/UpdateProfileScreen.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/UpdateProfileScreen.kt @@ -8,7 +8,7 @@ import androidx.compose.runtime.collectAsState import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.hilt.navigation.compose.hiltViewModel -import com.hieuwu.groceriesstore.domain.models.UserModel +import com.hieuwu.groceriesstore.core.models.UserModel import com.hieuwu.groceriesstore.presentation.account.DemoUser import com.hieuwu.groceriesstore.presentation.updateprofile.widgets.UpdateProfileAppBar import com.hieuwu.groceriesstore.presentation.updateprofile.widgets.UpdateProfileScreenContent diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/UpdateProfileViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/UpdateProfileViewModel.kt index 5cae7435..1fb2bb8a 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/UpdateProfileViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/UpdateProfileViewModel.kt @@ -4,7 +4,7 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hieuwu.groceriesstore.domain.models.UserModel +import com.hieuwu.groceriesstore.core.models.UserModel import com.hieuwu.groceriesstore.domain.usecases.GetProfileUseCase import com.hieuwu.groceriesstore.domain.usecases.UpdateProfileUseCase import dagger.hilt.android.lifecycle.HiltViewModel diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/widgets/UpdateProfileScreenContent.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/widgets/UpdateProfileScreenContent.kt index 85f53322..a313e0c0 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/widgets/UpdateProfileScreenContent.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/widgets/UpdateProfileScreenContent.kt @@ -16,7 +16,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.tooling.preview.Preview import com.hieuwu.groceriesstore.R -import com.hieuwu.groceriesstore.domain.models.UserModel +import com.hieuwu.groceriesstore.core.models.UserModel import com.hieuwu.groceriesstore.presentation.account.DemoUser @Composable diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImplTest.kt index 117acd1b..f4bb4246 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImplTest.kt @@ -1,7 +1,7 @@ package com.hieuwu.groceriesstore.domain.usecases.impl import com.hieuwu.groceriesstore.data.repository.ProductRepository -import com.hieuwu.groceriesstore.domain.models.ProductModel +import com.hieuwu.groceriesstore.core.models.ProductModel import com.hieuwu.groceriesstore.domain.usecases.SearchProductUseCase import junit.framework.TestCase import kotlinx.coroutines.Dispatchers diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImplTest.kt index 636ae50c..e554b407 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImplTest.kt @@ -1,7 +1,7 @@ package com.hieuwu.groceriesstore.domain.usecases.impl import com.hieuwu.groceriesstore.data.repository.OrderRepository -import com.hieuwu.groceriesstore.domain.models.OrderModel +import com.hieuwu.groceriesstore.core.models.OrderModel import com.hieuwu.groceriesstore.domain.usecases.SubmitOrderUseCase import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runBlocking diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImplTest.kt index e23282c6..9b834aac 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImplTest.kt @@ -2,8 +2,8 @@ package com.hieuwu.groceriesstore.domain.usecases.impl import com.hieuwu.groceriesstore.data.repository.OrderRepository import com.hieuwu.groceriesstore.data.repository.ProductRepository -import com.hieuwu.groceriesstore.domain.models.LineItemModel -import com.hieuwu.groceriesstore.domain.models.OrderModel +import com.hieuwu.groceriesstore.core.models.LineItemModel +import com.hieuwu.groceriesstore.core.models.OrderModel import com.hieuwu.groceriesstore.domain.usecases.UpdateCartItemUseCase import com.hieuwu.groceriesstore.utilities.OrderStatus import junit.framework.TestCase From 2dfd743a61e06846ef78777ce6fd2f4170766703 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sat, 3 Aug 2024 21:45:53 +0700 Subject: [PATCH 06/38] Remove unused lib --- gradle/libs.versions.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0774c4e4..bc65faab 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -40,7 +40,6 @@ moshiConverterVersion = "2.9.0" moshiVersion = "1.12.0" navigationComposeVersion = "2.5.3" navigationVersion = "2.5.0" -postgrestKtAndroidVersion = "2.0.0" retrofitVersion = "2.9.0" roomVersion = "2.5.0" spotlessVersion = "6.8.0" @@ -99,7 +98,6 @@ mockito-kotlin = { module = "org.mockito.kotlin:mockito-kotlin", version.ref = " moshi = { module = "com.squareup.moshi:moshi-kotlin", version.ref = "moshiVersion" } navigation-fragment = { module = "androidx.navigation:navigation-fragment-ktx", version.ref = "navigationVersion" } navigation-ui = { module = "androidx.navigation:navigation-ui-ktx", version.ref = "navigationVersion" } -postgrest-kt-android = { module = "io.github.jan-tennert.supabase:postgrest-kt-android", version.ref = "postgrestKtAndroidVersion" } retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofitVersion" } retrofit-converter-moshi = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "moshiConverterVersion" } retrofit-coroutines-adapter = { module = "com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter", version.ref = "kotlinCoroutineAdapter" } @@ -107,7 +105,6 @@ room = { module = "androidx.room:room-ktx", version.ref = "roomVersion" } room-compiler = { module = "androidx.room:room-compiler", version.ref = "roomVersion" } room-runtime = { module = "androidx.room:room-runtime", version.ref = "roomVersion" } timber = { module = "com.jakewharton.timber:timber", version.ref = "timberVersion" } - [bundles] androidx = [ "androidx-core", From 8efe384a15f64dc42374875acf18eb98f711be8f Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sat, 3 Aug 2024 22:25:40 +0700 Subject: [PATCH 07/38] Create shared module for models --- app/build.gradle | 1 + .../groceriesstore/data/database/entities/Category.kt | 1 - gradle/libs.versions.toml | 2 ++ models/.gitignore | 1 + models/build.gradle.kts | 9 +++++++++ .../java/com/hieuwu/groceriesstore/models/MyClass.kt | 4 ++++ settings.gradle | 3 ++- 7 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 models/.gitignore create mode 100644 models/build.gradle.kts create mode 100644 models/src/main/java/com/hieuwu/groceriesstore/models/MyClass.kt diff --git a/app/build.gradle b/app/build.gradle index 8289ab5a..a46b8b57 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -87,6 +87,7 @@ dependencies { implementation libs.timber implementation libs.bundles.room + implementation project(':models') kapt libs.room.compiler implementation libs.hilt diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Category.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Category.kt index f16bc9fe..349a7fb2 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Category.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Category.kt @@ -6,7 +6,6 @@ import androidx.room.Entity import androidx.room.PrimaryKey import com.hieuwu.groceriesstore.core.models.CategoryModel import com.hieuwu.groceriesstore.utilities.CATEGORY_TABLE - @Entity(tableName = CATEGORY_TABLE) data class Category( @PrimaryKey diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index bc65faab..e97ff1d0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -48,6 +48,7 @@ timberVersion = "5.0.1" uiToolingPreviewVersion = "1.6.1" uiToolingVersion = "1.4.2" workVersion = "2.7.1" +jetbrainsKotlinJvmVersion = "1.9.0" [libraries] accompanist-themeadapter-material = { module = "com.google.accompanist:accompanist-themeadapter-material", version.ref = "accompanistThemeadapterMaterialVersion" } @@ -134,3 +135,4 @@ kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlinVersion" ktlint-gradle = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlintGradleVersion" } navigation-safeargs = { id = "androidx.navigation.safeargs", version.ref = "navigationVersion"} spotless = { id = "com.diffplug.spotless", version.ref = "spotlessVersion" } +jetbrainsKotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "jetbrainsKotlinJvmVersion" } diff --git a/models/.gitignore b/models/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/models/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/models/build.gradle.kts b/models/build.gradle.kts new file mode 100644 index 00000000..623addac --- /dev/null +++ b/models/build.gradle.kts @@ -0,0 +1,9 @@ +plugins { + id("org.jetbrains.kotlin.jvm") version "1.9.0" + +} + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} \ No newline at end of file diff --git a/models/src/main/java/com/hieuwu/groceriesstore/models/MyClass.kt b/models/src/main/java/com/hieuwu/groceriesstore/models/MyClass.kt new file mode 100644 index 00000000..c3df7f61 --- /dev/null +++ b/models/src/main/java/com/hieuwu/groceriesstore/models/MyClass.kt @@ -0,0 +1,4 @@ +package com.hieuwu.groceriesstore.models + +class MyClass { +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index faf087fa..451d0a52 100644 --- a/settings.gradle +++ b/settings.gradle @@ -7,4 +7,5 @@ pluginManagement { } include ':app' -rootProject.name = "Groceries Store" \ No newline at end of file +rootProject.name = "Groceries Store" +include ':models' From 9c6fcd78dd599312b2b33ba75f36a06361d58e28 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sat, 3 Aug 2024 22:29:09 +0700 Subject: [PATCH 08/38] Move models to module --- .../java/com/hieuwu/groceriesstore}/models/CategoryModel.kt | 2 +- .../java/com/hieuwu/groceriesstore}/models/LineItemModel.kt | 2 +- .../main/java/com/hieuwu/groceriesstore}/models/MealModel.kt | 2 +- .../main/java/com/hieuwu/groceriesstore}/models/OrderModel.kt | 2 +- .../main/java/com/hieuwu/groceriesstore}/models/ProductModel.kt | 2 +- .../main/java/com/hieuwu/groceriesstore}/models/RecipeModel.kt | 2 +- .../main/java/com/hieuwu/groceriesstore}/models/UserModel.kt | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) rename {app/src/main/java/com/hieuwu/groceriesstore/core => models/src/main/java/com/hieuwu/groceriesstore}/models/CategoryModel.kt (70%) rename {app/src/main/java/com/hieuwu/groceriesstore/core => models/src/main/java/com/hieuwu/groceriesstore}/models/LineItemModel.kt (90%) rename {app/src/main/java/com/hieuwu/groceriesstore/core => models/src/main/java/com/hieuwu/groceriesstore}/models/MealModel.kt (81%) rename {app/src/main/java/com/hieuwu/groceriesstore/core => models/src/main/java/com/hieuwu/groceriesstore}/models/OrderModel.kt (91%) rename {app/src/main/java/com/hieuwu/groceriesstore/core => models/src/main/java/com/hieuwu/groceriesstore}/models/ProductModel.kt (82%) rename {app/src/main/java/com/hieuwu/groceriesstore/core => models/src/main/java/com/hieuwu/groceriesstore}/models/RecipeModel.kt (66%) rename {app/src/main/java/com/hieuwu/groceriesstore/core => models/src/main/java/com/hieuwu/groceriesstore}/models/UserModel.kt (85%) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/core/models/CategoryModel.kt b/models/src/main/java/com/hieuwu/groceriesstore/models/CategoryModel.kt similarity index 70% rename from app/src/main/java/com/hieuwu/groceriesstore/core/models/CategoryModel.kt rename to models/src/main/java/com/hieuwu/groceriesstore/models/CategoryModel.kt index 8c651ae0..7dc54969 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/core/models/CategoryModel.kt +++ b/models/src/main/java/com/hieuwu/groceriesstore/models/CategoryModel.kt @@ -1,4 +1,4 @@ -package com.hieuwu.groceriesstore.core.models +package com.hieuwu.groceriesstore.models data class CategoryModel( var id: String, diff --git a/app/src/main/java/com/hieuwu/groceriesstore/core/models/LineItemModel.kt b/models/src/main/java/com/hieuwu/groceriesstore/models/LineItemModel.kt similarity index 90% rename from app/src/main/java/com/hieuwu/groceriesstore/core/models/LineItemModel.kt rename to models/src/main/java/com/hieuwu/groceriesstore/models/LineItemModel.kt index e8569e5f..8882e627 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/core/models/LineItemModel.kt +++ b/models/src/main/java/com/hieuwu/groceriesstore/models/LineItemModel.kt @@ -1,4 +1,4 @@ -package com.hieuwu.groceriesstore.core.models +package com.hieuwu.groceriesstore.models data class LineItemModel( var id: Long? = null, diff --git a/app/src/main/java/com/hieuwu/groceriesstore/core/models/MealModel.kt b/models/src/main/java/com/hieuwu/groceriesstore/models/MealModel.kt similarity index 81% rename from app/src/main/java/com/hieuwu/groceriesstore/core/models/MealModel.kt rename to models/src/main/java/com/hieuwu/groceriesstore/models/MealModel.kt index b05195ca..1054871e 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/core/models/MealModel.kt +++ b/models/src/main/java/com/hieuwu/groceriesstore/models/MealModel.kt @@ -1,4 +1,4 @@ -package com.hieuwu.groceriesstore.core.models +package com.hieuwu.groceriesstore.models data class MealModel( val id: String, diff --git a/app/src/main/java/com/hieuwu/groceriesstore/core/models/OrderModel.kt b/models/src/main/java/com/hieuwu/groceriesstore/models/OrderModel.kt similarity index 91% rename from app/src/main/java/com/hieuwu/groceriesstore/core/models/OrderModel.kt rename to models/src/main/java/com/hieuwu/groceriesstore/models/OrderModel.kt index 0f35d224..4b6c31db 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/core/models/OrderModel.kt +++ b/models/src/main/java/com/hieuwu/groceriesstore/models/OrderModel.kt @@ -1,4 +1,4 @@ -package com.hieuwu.groceriesstore.core.models +package com.hieuwu.groceriesstore.models data class OrderModel( var id: String = "", diff --git a/app/src/main/java/com/hieuwu/groceriesstore/core/models/ProductModel.kt b/models/src/main/java/com/hieuwu/groceriesstore/models/ProductModel.kt similarity index 82% rename from app/src/main/java/com/hieuwu/groceriesstore/core/models/ProductModel.kt rename to models/src/main/java/com/hieuwu/groceriesstore/models/ProductModel.kt index 8521a4a0..bb762ef9 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/core/models/ProductModel.kt +++ b/models/src/main/java/com/hieuwu/groceriesstore/models/ProductModel.kt @@ -1,4 +1,4 @@ -package com.hieuwu.groceriesstore.core.models +package com.hieuwu.groceriesstore.models data class ProductModel( var id: String, diff --git a/app/src/main/java/com/hieuwu/groceriesstore/core/models/RecipeModel.kt b/models/src/main/java/com/hieuwu/groceriesstore/models/RecipeModel.kt similarity index 66% rename from app/src/main/java/com/hieuwu/groceriesstore/core/models/RecipeModel.kt rename to models/src/main/java/com/hieuwu/groceriesstore/models/RecipeModel.kt index 4e3f6a52..60f3d90d 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/core/models/RecipeModel.kt +++ b/models/src/main/java/com/hieuwu/groceriesstore/models/RecipeModel.kt @@ -1,4 +1,4 @@ -package com.hieuwu.groceriesstore.core.models +package com.hieuwu.groceriesstore.models data class RecipeModel( val id: String, diff --git a/app/src/main/java/com/hieuwu/groceriesstore/core/models/UserModel.kt b/models/src/main/java/com/hieuwu/groceriesstore/models/UserModel.kt similarity index 85% rename from app/src/main/java/com/hieuwu/groceriesstore/core/models/UserModel.kt rename to models/src/main/java/com/hieuwu/groceriesstore/models/UserModel.kt index 4658a902..10fbc563 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/core/models/UserModel.kt +++ b/models/src/main/java/com/hieuwu/groceriesstore/models/UserModel.kt @@ -1,4 +1,4 @@ -package com.hieuwu.groceriesstore.core.models +package com.hieuwu.groceriesstore.models data class UserModel( val id: String, From 83f610f1a95c3402cf0bf09a1102870693455972 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sat, 3 Aug 2024 22:29:17 +0700 Subject: [PATCH 09/38] Update package --- .../domain/usecases/impl/GetCategoriesListUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/GetCurrentCartUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/GetProductDetailUseCaseImplTest.kt | 2 +- .../usecases/impl/GetProductsByCategoryUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/GetProductsListUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/GetProfileUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/SearchProductUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/SubmitOrderUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/UpdateCartItemUseCaseImplTest.kt | 4 ++-- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImplTest.kt index c38f5b84..36bb3046 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImplTest.kt @@ -1,7 +1,7 @@ package com.hieuwu.groceriesstore.domain.usecases.impl import com.hieuwu.groceriesstore.data.repository.CategoryRepository -import com.hieuwu.groceriesstore.core.models.CategoryModel +import com.hieuwu.groceriesstore.models.CategoryModel import com.hieuwu.groceriesstore.domain.usecases.GetCategoriesListUseCase import junit.framework.TestCase.assertEquals import kotlinx.coroutines.flow.flow diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImplTest.kt index dd2995d3..064de31e 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImplTest.kt @@ -1,7 +1,7 @@ package com.hieuwu.groceriesstore.domain.usecases.impl import com.hieuwu.groceriesstore.data.repository.OrderRepository -import com.hieuwu.groceriesstore.core.models.OrderModel +import com.hieuwu.groceriesstore.models.OrderModel import com.hieuwu.groceriesstore.domain.usecases.GetCurrentCartUseCase import com.hieuwu.groceriesstore.utilities.OrderStatus import junit.framework.TestCase.assertEquals diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImplTest.kt index e30525a7..eb73f91b 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImplTest.kt @@ -1,7 +1,7 @@ package com.hieuwu.groceriesstore.domain.usecases.impl import com.hieuwu.groceriesstore.data.repository.ProductRepository -import com.hieuwu.groceriesstore.core.models.ProductModel +import com.hieuwu.groceriesstore.models.ProductModel import com.hieuwu.groceriesstore.domain.usecases.GetProductDetailUseCase import junit.framework.TestCase import kotlinx.coroutines.flow.flow diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImplTest.kt index 5794605e..9d9c7394 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImplTest.kt @@ -1,7 +1,7 @@ package com.hieuwu.groceriesstore.domain.usecases.impl import com.hieuwu.groceriesstore.data.repository.ProductRepository -import com.hieuwu.groceriesstore.core.models.ProductModel +import com.hieuwu.groceriesstore.models.ProductModel import com.hieuwu.groceriesstore.domain.usecases.GetProductsByCategoryUseCase import junit.framework.TestCase import kotlinx.coroutines.flow.flow diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImplTest.kt index 7c270bb7..6bab9d01 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImplTest.kt @@ -1,7 +1,7 @@ package com.hieuwu.groceriesstore.domain.usecases.impl import com.hieuwu.groceriesstore.data.repository.ProductRepository -import com.hieuwu.groceriesstore.core.models.ProductModel +import com.hieuwu.groceriesstore.models.ProductModel import com.hieuwu.groceriesstore.domain.usecases.GetProductsListUseCase import junit.framework.TestCase.assertEquals import kotlinx.coroutines.flow.flow diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImplTest.kt index af64641e..e295f8c8 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImplTest.kt @@ -1,7 +1,7 @@ package com.hieuwu.groceriesstore.domain.usecases.impl import com.hieuwu.groceriesstore.data.repository.UserRepository -import com.hieuwu.groceriesstore.core.models.UserModel +import com.hieuwu.groceriesstore.models.UserModel import com.hieuwu.groceriesstore.domain.usecases.GetProfileUseCase import junit.framework.TestCase.assertEquals import junit.framework.TestCase.assertNotNull diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImplTest.kt index f4bb4246..5c611fa3 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImplTest.kt @@ -1,7 +1,7 @@ package com.hieuwu.groceriesstore.domain.usecases.impl import com.hieuwu.groceriesstore.data.repository.ProductRepository -import com.hieuwu.groceriesstore.core.models.ProductModel +import com.hieuwu.groceriesstore.models.ProductModel import com.hieuwu.groceriesstore.domain.usecases.SearchProductUseCase import junit.framework.TestCase import kotlinx.coroutines.Dispatchers diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImplTest.kt index e554b407..1f267a7b 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImplTest.kt @@ -1,7 +1,7 @@ package com.hieuwu.groceriesstore.domain.usecases.impl import com.hieuwu.groceriesstore.data.repository.OrderRepository -import com.hieuwu.groceriesstore.core.models.OrderModel +import com.hieuwu.groceriesstore.models.OrderModel import com.hieuwu.groceriesstore.domain.usecases.SubmitOrderUseCase import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runBlocking diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImplTest.kt index 9b834aac..3e6b1ae2 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImplTest.kt @@ -2,8 +2,8 @@ package com.hieuwu.groceriesstore.domain.usecases.impl import com.hieuwu.groceriesstore.data.repository.OrderRepository import com.hieuwu.groceriesstore.data.repository.ProductRepository -import com.hieuwu.groceriesstore.core.models.LineItemModel -import com.hieuwu.groceriesstore.core.models.OrderModel +import com.hieuwu.groceriesstore.models.LineItemModel +import com.hieuwu.groceriesstore.models.OrderModel import com.hieuwu.groceriesstore.domain.usecases.UpdateCartItemUseCase import com.hieuwu.groceriesstore.utilities.OrderStatus import junit.framework.TestCase From 01c8bd82c6483035c4ab9fe05dd17ab5d2dcad30 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sat, 3 Aug 2024 22:29:41 +0700 Subject: [PATCH 10/38] Update package --- .../hieuwu/groceriesstore/data/database/entities/Category.kt | 2 +- .../data/database/entities/OrderWithLineItems.kt | 2 +- .../hieuwu/groceriesstore/data/database/entities/Product.kt | 2 +- .../data/database/entities/ProductAndLineItem.kt | 2 +- .../hieuwu/groceriesstore/data/database/entities/Recipe.kt | 2 +- .../com/hieuwu/groceriesstore/data/database/entities/User.kt | 2 +- .../groceriesstore/data/repository/CategoryRepository.kt | 2 +- .../groceriesstore/data/repository/MealPlanRepository.kt | 2 +- .../hieuwu/groceriesstore/data/repository/OrderRepository.kt | 2 +- .../groceriesstore/data/repository/ProductRepository.kt | 2 +- .../hieuwu/groceriesstore/data/repository/RecipeRepository.kt | 2 +- .../hieuwu/groceriesstore/data/repository/UserRepository.kt | 2 +- .../data/repository/impl/MealPlanRepositoryImpl.kt | 2 +- .../data/repository/impl/OrderRepositoryImpl.kt | 4 ++-- .../data/repository/impl/ProductRepositoryImpl.kt | 2 +- 15 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Category.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Category.kt index 349a7fb2..2d44236f 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Category.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Category.kt @@ -4,7 +4,7 @@ import androidx.annotation.NonNull import androidx.room.ColumnInfo import androidx.room.Entity import androidx.room.PrimaryKey -import com.hieuwu.groceriesstore.core.models.CategoryModel +import com.hieuwu.groceriesstore.models.CategoryModel import com.hieuwu.groceriesstore.utilities.CATEGORY_TABLE @Entity(tableName = CATEGORY_TABLE) data class Category( diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/OrderWithLineItems.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/OrderWithLineItems.kt index 940e8a8d..09ca2c87 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/OrderWithLineItems.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/OrderWithLineItems.kt @@ -2,7 +2,7 @@ package com.hieuwu.groceriesstore.data.database.entities import androidx.room.Embedded import androidx.room.Relation -import com.hieuwu.groceriesstore.core.models.OrderModel +import com.hieuwu.groceriesstore.models.OrderModel data class OrderWithLineItems( @Embedded var order: Order, diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Product.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Product.kt index 2a88f636..1eb3bb1a 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Product.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Product.kt @@ -4,7 +4,7 @@ import androidx.annotation.NonNull import androidx.room.ColumnInfo import androidx.room.Entity import androidx.room.PrimaryKey -import com.hieuwu.groceriesstore.core.models.ProductModel +import com.hieuwu.groceriesstore.models.ProductModel import com.hieuwu.groceriesstore.utilities.PRODUCT_TABLE @Entity(tableName = PRODUCT_TABLE) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/ProductAndLineItem.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/ProductAndLineItem.kt index b44be792..5ba3b51b 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/ProductAndLineItem.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/ProductAndLineItem.kt @@ -2,7 +2,7 @@ package com.hieuwu.groceriesstore.data.database.entities import androidx.room.Embedded import androidx.room.Relation -import com.hieuwu.groceriesstore.core.models.LineItemModel +import com.hieuwu.groceriesstore.models.LineItemModel data class ProductAndLineItem( @Embedded val lineItem: LineItem?, diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Recipe.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Recipe.kt index 9eb43861..9d9b53c1 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Recipe.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/Recipe.kt @@ -3,7 +3,7 @@ package com.hieuwu.groceriesstore.data.database.entities import androidx.room.ColumnInfo import androidx.room.Entity import androidx.room.PrimaryKey -import com.hieuwu.groceriesstore.core.models.RecipeModel +import com.hieuwu.groceriesstore.models.RecipeModel import com.hieuwu.groceriesstore.utilities.RECIPE_TABLE @Entity(tableName = RECIPE_TABLE) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/User.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/User.kt index 89209c24..ea64ab31 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/User.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/database/entities/User.kt @@ -3,7 +3,7 @@ package com.hieuwu.groceriesstore.data.database.entities import androidx.room.ColumnInfo import androidx.room.Entity import androidx.room.PrimaryKey -import com.hieuwu.groceriesstore.core.models.UserModel +import com.hieuwu.groceriesstore.models.UserModel import com.hieuwu.groceriesstore.utilities.USER_TABLE @Entity(tableName = USER_TABLE) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/CategoryRepository.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/CategoryRepository.kt index 206fddab..ea92dd49 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/CategoryRepository.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/CategoryRepository.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.data.repository -import com.hieuwu.groceriesstore.core.models.CategoryModel +import com.hieuwu.groceriesstore.models.CategoryModel import kotlinx.coroutines.flow.Flow interface CategoryRepository { diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/MealPlanRepository.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/MealPlanRepository.kt index ca24bdff..e21e38c8 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/MealPlanRepository.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/MealPlanRepository.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.data.repository -import com.hieuwu.groceriesstore.core.models.MealModel +import com.hieuwu.groceriesstore.models.MealModel interface MealPlanRepository { suspend fun addMealToPlan( diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/OrderRepository.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/OrderRepository.kt index 4d559e1d..e280a631 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/OrderRepository.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/OrderRepository.kt @@ -2,7 +2,7 @@ package com.hieuwu.groceriesstore.data.repository import com.hieuwu.groceriesstore.data.database.entities.LineItem import com.hieuwu.groceriesstore.data.database.entities.Order -import com.hieuwu.groceriesstore.core.models.OrderModel +import com.hieuwu.groceriesstore.models.OrderModel import com.hieuwu.groceriesstore.utilities.OrderStatus import kotlinx.coroutines.flow.Flow diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/ProductRepository.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/ProductRepository.kt index 128cb6af..059908df 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/ProductRepository.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/ProductRepository.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.data.repository -import com.hieuwu.groceriesstore.core.models.ProductModel +import com.hieuwu.groceriesstore.models.ProductModel import kotlinx.coroutines.flow.Flow interface ProductRepository { diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/RecipeRepository.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/RecipeRepository.kt index 2f0a8b50..9e824b63 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/RecipeRepository.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/RecipeRepository.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.data.repository -import com.hieuwu.groceriesstore.core.models.RecipeModel +import com.hieuwu.groceriesstore.models.RecipeModel import kotlinx.coroutines.flow.Flow interface RecipeRepository { diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/UserRepository.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/UserRepository.kt index 32517aa4..0c949750 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/UserRepository.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/UserRepository.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.data.repository -import com.hieuwu.groceriesstore.core.models.UserModel +import com.hieuwu.groceriesstore.models.UserModel import kotlinx.coroutines.flow.Flow interface UserRepository { diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/MealPlanRepositoryImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/MealPlanRepositoryImpl.kt index 35d8cb28..226849d1 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/MealPlanRepositoryImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/MealPlanRepositoryImpl.kt @@ -3,7 +3,7 @@ package com.hieuwu.groceriesstore.data.repository.impl import com.hieuwu.groceriesstore.data.network.dto.Meal import com.hieuwu.groceriesstore.data.repository.MealPlanRepository import com.hieuwu.groceriesstore.data.repository.UserRepository -import com.hieuwu.groceriesstore.core.models.MealModel +import com.hieuwu.groceriesstore.models.MealModel import com.hieuwu.groceriesstore.utilities.SupabaseHelper import io.github.jan.supabase.postgrest.Postgrest import io.github.jan.supabase.storage.Storage diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/OrderRepositoryImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/OrderRepositoryImpl.kt index d152af94..59577b89 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/OrderRepositoryImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/OrderRepositoryImpl.kt @@ -7,11 +7,11 @@ import com.hieuwu.groceriesstore.data.database.entities.Order import com.hieuwu.groceriesstore.data.database.entities.asDomainModel import com.hieuwu.groceriesstore.data.network.dto.OrderDto import com.hieuwu.groceriesstore.data.repository.OrderRepository -import com.hieuwu.groceriesstore.core.models.OrderModel +import com.hieuwu.groceriesstore.models.OrderModel import com.hieuwu.groceriesstore.utilities.OrderStatus import com.hieuwu.groceriesstore.data.network.RemoteTable import com.hieuwu.groceriesstore.data.network.dto.LineItemDto -import com.hieuwu.groceriesstore.core.models.LineItemModel +import com.hieuwu.groceriesstore.models.LineItemModel import io.github.jan.supabase.postgrest.Postgrest import java.util.Date import kotlinx.coroutines.flow.Flow diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/ProductRepositoryImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/ProductRepositoryImpl.kt index 5a8bdca7..e355044a 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/ProductRepositoryImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/ProductRepositoryImpl.kt @@ -7,7 +7,7 @@ import com.hieuwu.groceriesstore.data.database.entities.asDomainModel import com.hieuwu.groceriesstore.data.network.RemoteTable import com.hieuwu.groceriesstore.data.network.dto.ProductDto import com.hieuwu.groceriesstore.data.repository.ProductRepository -import com.hieuwu.groceriesstore.core.models.ProductModel +import com.hieuwu.groceriesstore.models.ProductModel import io.github.jan.supabase.postgrest.Postgrest import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flow From 09727ba381463a3fe5562b13070ce12641b698bf Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sat, 3 Aug 2024 22:29:47 +0700 Subject: [PATCH 11/38] Update package --- .../domain/usecases/GetCategoriesListUseCase.kt | 2 +- .../groceriesstore/domain/usecases/GetCurrentCartUseCase.kt | 2 +- .../groceriesstore/domain/usecases/GetOrderListUseCase.kt | 2 +- .../groceriesstore/domain/usecases/GetProductDetailUseCase.kt | 2 +- .../domain/usecases/GetProductsByCategoryUseCase.kt | 2 +- .../groceriesstore/domain/usecases/GetProductsListUseCase.kt | 2 +- .../groceriesstore/domain/usecases/GetProfileUseCase.kt | 2 +- .../domain/usecases/RetrieveMealByTypeUseCase.kt | 2 +- .../groceriesstore/domain/usecases/SearchProductUseCase.kt | 2 +- .../groceriesstore/domain/usecases/SubmitOrderUseCase.kt | 2 +- .../groceriesstore/domain/usecases/UpdateCartItemUseCase.kt | 4 ++-- .../domain/usecases/impl/RetrieveMealByTypeUseCaseImpl.kt | 2 +- .../domain/usecases/impl/UpdateCartItemUseCaseImpl.kt | 4 ++-- 13 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetCategoriesListUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetCategoriesListUseCase.kt index 24d7f43b..00aac0d2 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetCategoriesListUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetCategoriesListUseCase.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.core.models.CategoryModel +import com.hieuwu.groceriesstore.models.CategoryModel import kotlinx.coroutines.flow.Flow interface GetCategoriesListUseCase : diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetCurrentCartUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetCurrentCartUseCase.kt index da968a94..3a8c92d4 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetCurrentCartUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetCurrentCartUseCase.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.core.models.OrderModel +import com.hieuwu.groceriesstore.models.OrderModel import kotlinx.coroutines.flow.Flow interface GetCurrentCartUseCase : diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetOrderListUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetOrderListUseCase.kt index c9f81a6d..f5811497 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetOrderListUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetOrderListUseCase.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.core.models.OrderModel +import com.hieuwu.groceriesstore.models.OrderModel interface GetOrderListUseCase : SuspendUseCase { class Input diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductDetailUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductDetailUseCase.kt index 81f1da31..b7781790 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductDetailUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductDetailUseCase.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.core.models.ProductModel +import com.hieuwu.groceriesstore.models.ProductModel import kotlinx.coroutines.flow.Flow interface GetProductDetailUseCase { diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductsByCategoryUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductsByCategoryUseCase.kt index 2ff427b7..d30001f1 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductsByCategoryUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductsByCategoryUseCase.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.core.models.ProductModel +import com.hieuwu.groceriesstore.models.ProductModel import kotlinx.coroutines.flow.Flow interface GetProductsByCategoryUseCase : diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductsListUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductsListUseCase.kt index 06298041..ef316d56 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductsListUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProductsListUseCase.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.core.models.ProductModel +import com.hieuwu.groceriesstore.models.ProductModel import kotlinx.coroutines.flow.Flow interface GetProductsListUseCase: UseCase { diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProfileUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProfileUseCase.kt index 61c68b39..90852aa1 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProfileUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/GetProfileUseCase.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.core.models.UserModel +import com.hieuwu.groceriesstore.models.UserModel import kotlinx.coroutines.flow.Flow interface GetProfileUseCase:SuspendUseCase { diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/RetrieveMealByTypeUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/RetrieveMealByTypeUseCase.kt index 8803872c..20819af6 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/RetrieveMealByTypeUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/RetrieveMealByTypeUseCase.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.core.models.MealModel +import com.hieuwu.groceriesstore.models.MealModel import com.hieuwu.groceriesstore.presentation.mealplanning.overview.state.MealType import com.hieuwu.groceriesstore.presentation.mealplanning.overview.state.WeekDayValue diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/SearchProductUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/SearchProductUseCase.kt index 1ddce46e..aafe0a3d 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/SearchProductUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/SearchProductUseCase.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.core.models.ProductModel +import com.hieuwu.groceriesstore.models.ProductModel import kotlinx.coroutines.flow.Flow interface SearchProductUseCase : SuspendUseCase { diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/SubmitOrderUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/SubmitOrderUseCase.kt index 41709312..87f275cf 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/SubmitOrderUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/SubmitOrderUseCase.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.core.models.OrderModel +import com.hieuwu.groceriesstore.models.OrderModel interface SubmitOrderUseCase : SuspendUseCase { class Input(val order: OrderModel) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/UpdateCartItemUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/UpdateCartItemUseCase.kt index 98ae21e2..37cd750f 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/UpdateCartItemUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/UpdateCartItemUseCase.kt @@ -1,7 +1,7 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.core.models.LineItemModel -import com.hieuwu.groceriesstore.core.models.OrderModel +import com.hieuwu.groceriesstore.models.LineItemModel +import com.hieuwu.groceriesstore.models.OrderModel import kotlinx.coroutines.flow.Flow interface UpdateCartItemUseCase { diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RetrieveMealByTypeUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RetrieveMealByTypeUseCaseImpl.kt index 9d4f3bd2..73a049bf 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RetrieveMealByTypeUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RetrieveMealByTypeUseCaseImpl.kt @@ -2,7 +2,7 @@ package com.hieuwu.groceriesstore.domain.usecases.impl import com.hieuwu.groceriesstore.data.repository.MealPlanRepository import com.hieuwu.groceriesstore.di.IoDispatcher -import com.hieuwu.groceriesstore.core.models.MealModel +import com.hieuwu.groceriesstore.models.MealModel import com.hieuwu.groceriesstore.domain.usecases.RetrieveMealByTypeUseCase import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.first diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImpl.kt index ccdb444c..c6a2dd8d 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImpl.kt @@ -3,8 +3,8 @@ package com.hieuwu.groceriesstore.domain.usecases.impl import com.hieuwu.groceriesstore.data.repository.OrderRepository import com.hieuwu.groceriesstore.data.repository.ProductRepository import com.hieuwu.groceriesstore.di.IoDispatcher -import com.hieuwu.groceriesstore.core.models.LineItemModel -import com.hieuwu.groceriesstore.core.models.OrderModel +import com.hieuwu.groceriesstore.models.LineItemModel +import com.hieuwu.groceriesstore.models.OrderModel import com.hieuwu.groceriesstore.domain.usecases.UpdateCartItemUseCase import com.hieuwu.groceriesstore.utilities.OrderStatus import kotlinx.coroutines.CoroutineDispatcher From 7f644f83d2f07ea8830d1f7eaf61a46fa96f96fa Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sat, 3 Aug 2024 22:29:54 +0700 Subject: [PATCH 12/38] Update package --- .../hieuwu/groceriesstore/presentation/account/AccountScreen.kt | 2 +- .../groceriesstore/presentation/account/AccountViewModel.kt | 2 +- .../presentation/account/widgets/AccountContentView.kt | 2 +- .../presentation/account/widgets/AccountHeaderView.kt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/AccountScreen.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/AccountScreen.kt index f1ca3b6a..ab39b080 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/AccountScreen.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/AccountScreen.kt @@ -11,7 +11,7 @@ import androidx.compose.ui.res.dimensionResource import androidx.compose.ui.tooling.preview.Preview import androidx.hilt.navigation.compose.hiltViewModel import com.hieuwu.groceriesstore.R -import com.hieuwu.groceriesstore.core.models.UserModel +import com.hieuwu.groceriesstore.models.UserModel import com.hieuwu.groceriesstore.presentation.account.widgets.AccountContentView import com.hieuwu.groceriesstore.presentation.account.widgets.AccountHeaderView diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/AccountViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/AccountViewModel.kt index ecca464d..6ed3aa69 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/AccountViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/AccountViewModel.kt @@ -2,7 +2,7 @@ package com.hieuwu.groceriesstore.presentation.account import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hieuwu.groceriesstore.core.models.UserModel +import com.hieuwu.groceriesstore.models.UserModel import com.hieuwu.groceriesstore.domain.usecases.GetProfileUseCase import com.hieuwu.groceriesstore.domain.usecases.SignOutUseCase import dagger.hilt.android.lifecycle.HiltViewModel diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/widgets/AccountContentView.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/widgets/AccountContentView.kt index f0f9152f..c3e93a03 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/widgets/AccountContentView.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/widgets/AccountContentView.kt @@ -19,7 +19,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.tooling.preview.Preview import com.hieuwu.groceriesstore.R -import com.hieuwu.groceriesstore.core.models.UserModel +import com.hieuwu.groceriesstore.models.UserModel import com.hieuwu.groceriesstore.presentation.account.DemoUser import com.hieuwu.groceriesstore.presentation.core.widgets.PrimaryButton import com.hieuwu.groceriesstore.presentation.core.widgets.SecondaryButton diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/widgets/AccountHeaderView.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/widgets/AccountHeaderView.kt index 22a4a14c..ae20aa02 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/widgets/AccountHeaderView.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/account/widgets/AccountHeaderView.kt @@ -22,7 +22,7 @@ import com.airbnb.lottie.compose.LottieCompositionSpec import com.airbnb.lottie.compose.LottieConstants import com.airbnb.lottie.compose.rememberLottieComposition import com.hieuwu.groceriesstore.R -import com.hieuwu.groceriesstore.core.models.UserModel +import com.hieuwu.groceriesstore.models.UserModel import com.hieuwu.groceriesstore.presentation.account.DemoUser import com.hieuwu.groceriesstore.presentation.utils.Converter import com.hieuwu.groceriesstore.presentation.utils.textUnit From d3066257b8545052e9427580ca03ecf02c2c7835 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sat, 3 Aug 2024 22:29:57 +0700 Subject: [PATCH 13/38] Update package --- .../hieuwu/groceriesstore/presentation/cart/CartViewModel.kt | 4 ++-- .../groceriesstore/presentation/cart/composables/CartItem.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/cart/CartViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/cart/CartViewModel.kt index 318a78a4..f59ff230 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/cart/CartViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/cart/CartViewModel.kt @@ -2,8 +2,8 @@ package com.hieuwu.groceriesstore.presentation.cart import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hieuwu.groceriesstore.core.models.LineItemModel -import com.hieuwu.groceriesstore.core.models.OrderModel +import com.hieuwu.groceriesstore.models.LineItemModel +import com.hieuwu.groceriesstore.models.OrderModel import com.hieuwu.groceriesstore.domain.usecases.UpdateCartItemUseCase import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.SharingStarted diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/cart/composables/CartItem.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/cart/composables/CartItem.kt index 9c600ce4..e2302e8b 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/cart/composables/CartItem.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/cart/composables/CartItem.kt @@ -27,7 +27,7 @@ import androidx.compose.ui.unit.dp import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi import com.bumptech.glide.integration.compose.GlideImage import com.hieuwu.groceriesstore.R -import com.hieuwu.groceriesstore.core.models.LineItemModel +import com.hieuwu.groceriesstore.models.LineItemModel @OptIn(ExperimentalGlideComposeApi::class) @Composable From 8b0a9b136c708dca539bd44b5ba732cb7c1a2093 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sat, 3 Aug 2024 22:30:01 +0700 Subject: [PATCH 14/38] Update package --- .../groceriesstore/presentation/checkout/CheckOutViewModel.kt | 4 ++-- .../presentation/checkout/composables/CardDetailList.kt | 2 +- .../presentation/checkout/composables/CartItem.kt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/CheckOutViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/CheckOutViewModel.kt index 9912df5d..71d70493 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/CheckOutViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/CheckOutViewModel.kt @@ -2,8 +2,8 @@ package com.hieuwu.groceriesstore.presentation.checkout import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hieuwu.groceriesstore.core.models.OrderModel -import com.hieuwu.groceriesstore.core.models.UserModel +import com.hieuwu.groceriesstore.models.OrderModel +import com.hieuwu.groceriesstore.models.UserModel import com.hieuwu.groceriesstore.domain.usecases.GetCurrentCartUseCase import com.hieuwu.groceriesstore.domain.usecases.GetProfileUseCase import com.hieuwu.groceriesstore.domain.usecases.SubmitOrderUseCase diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/composables/CardDetailList.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/composables/CardDetailList.kt index 2d84033a..141d61f9 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/composables/CardDetailList.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/composables/CardDetailList.kt @@ -6,7 +6,7 @@ import androidx.compose.foundation.lazy.items import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import com.hieuwu.groceriesstore.core.models.LineItemModel +import com.hieuwu.groceriesstore.models.LineItemModel import com.hieuwu.groceriesstore.presentation.checkout.composables.CartItem @Composable diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/composables/CartItem.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/composables/CartItem.kt index e4ca76cc..e6954556 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/composables/CartItem.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/checkout/composables/CartItem.kt @@ -31,7 +31,7 @@ import androidx.compose.ui.unit.sp import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi import com.bumptech.glide.integration.compose.GlideImage import com.hieuwu.groceriesstore.R -import com.hieuwu.groceriesstore.core.models.LineItemModel +import com.hieuwu.groceriesstore.models.LineItemModel @OptIn(ExperimentalGlideComposeApi::class) @Composable From 2c7253128c66862719b4a4db6ebbf14b366f16d4 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sat, 3 Aug 2024 22:30:10 +0700 Subject: [PATCH 15/38] Update package --- .../groceriesstore/presentation/explore/ExploreScreen.kt | 4 ++-- .../groceriesstore/presentation/explore/ExploreViewModel.kt | 6 +++--- .../presentation/explore/composables/CategoryItem.kt | 2 +- .../presentation/explore/composables/ProductItem.kt | 2 +- .../presentation/favourite/FavouriteViewModel.kt | 2 +- .../presentation/favourite/composables/RecipeItem.kt | 2 +- .../presentation/mealplanning/overview/OverviewViewModel.kt | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreScreen.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreScreen.kt index 84e13a97..9f6cca36 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreScreen.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreScreen.kt @@ -46,8 +46,8 @@ import com.airbnb.lottie.compose.LottieCompositionSpec import com.airbnb.lottie.compose.LottieConstants import com.airbnb.lottie.compose.rememberLottieComposition import com.hieuwu.groceriesstore.R -import com.hieuwu.groceriesstore.core.models.CategoryModel -import com.hieuwu.groceriesstore.core.models.ProductModel +import com.hieuwu.groceriesstore.models.CategoryModel +import com.hieuwu.groceriesstore.models.ProductModel import com.hieuwu.groceriesstore.presentation.explore.composables.CategoryItem import com.hieuwu.groceriesstore.presentation.explore.composables.ProductItem import kotlinx.coroutines.launch diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreViewModel.kt index b256d360..930db94e 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreViewModel.kt @@ -4,9 +4,9 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.hieuwu.groceriesstore.data.database.entities.LineItem import com.hieuwu.groceriesstore.data.database.entities.Order -import com.hieuwu.groceriesstore.core.models.CategoryModel -import com.hieuwu.groceriesstore.core.models.OrderModel -import com.hieuwu.groceriesstore.core.models.ProductModel +import com.hieuwu.groceriesstore.models.CategoryModel +import com.hieuwu.groceriesstore.models.OrderModel +import com.hieuwu.groceriesstore.models.ProductModel import com.hieuwu.groceriesstore.domain.usecases.AddToCartUseCase import com.hieuwu.groceriesstore.domain.usecases.CreateNewOrderUseCase import com.hieuwu.groceriesstore.domain.usecases.GetCategoriesListUseCase diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/composables/CategoryItem.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/composables/CategoryItem.kt index bb5d917c..d0428787 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/composables/CategoryItem.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/composables/CategoryItem.kt @@ -20,7 +20,7 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi import com.bumptech.glide.integration.compose.GlideImage -import com.hieuwu.groceriesstore.core.models.CategoryModel +import com.hieuwu.groceriesstore.models.CategoryModel @OptIn( ExperimentalGlideComposeApi::class, diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/composables/ProductItem.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/composables/ProductItem.kt index 56a13b42..a0223d32 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/composables/ProductItem.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/composables/ProductItem.kt @@ -29,7 +29,7 @@ import androidx.compose.ui.unit.dp import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi import com.bumptech.glide.integration.compose.GlideImage import com.hieuwu.groceriesstore.R -import com.hieuwu.groceriesstore.core.models.ProductModel +import com.hieuwu.groceriesstore.models.ProductModel @OptIn(ExperimentalGlideComposeApi::class, ExperimentalMaterialApi::class) @Composable diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/FavouriteViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/FavouriteViewModel.kt index 5e1e4774..9540677f 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/FavouriteViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/FavouriteViewModel.kt @@ -6,7 +6,7 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.asLiveData import androidx.lifecycle.viewModelScope import com.hieuwu.groceriesstore.data.repository.RecipeRepository -import com.hieuwu.groceriesstore.core.models.RecipeModel +import com.hieuwu.groceriesstore.models.RecipeModel import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.stateIn diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/composables/RecipeItem.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/composables/RecipeItem.kt index 1f63f717..c84f669c 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/composables/RecipeItem.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/composables/RecipeItem.kt @@ -14,7 +14,7 @@ import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.unit.dp import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi import com.bumptech.glide.integration.compose.GlideImage -import com.hieuwu.groceriesstore.core.models.RecipeModel +import com.hieuwu.groceriesstore.models.RecipeModel @OptIn(ExperimentalGlideComposeApi::class) @Composable diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/mealplanning/overview/OverviewViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/mealplanning/overview/OverviewViewModel.kt index 853f9d2b..4bcb1884 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/mealplanning/overview/OverviewViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/mealplanning/overview/OverviewViewModel.kt @@ -2,7 +2,7 @@ package com.hieuwu.groceriesstore.presentation.mealplanning.overview import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hieuwu.groceriesstore.core.models.MealModel +import com.hieuwu.groceriesstore.models.MealModel import com.hieuwu.groceriesstore.domain.usecases.AddMealToPlanUseCase import com.hieuwu.groceriesstore.domain.usecases.RemoveMealFromPlanUseCase import com.hieuwu.groceriesstore.domain.usecases.RetrieveMealByTypeUseCase From 93a18d245ad63a68aeaf8e29c2f26b27ed7f2cec Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sat, 3 Aug 2024 22:30:14 +0700 Subject: [PATCH 16/38] Update package --- .../notificationsettings/NotificationSettingsViewModel.kt | 2 +- .../presentation/orderhistory/OrderListViewModel.kt | 2 +- .../presentation/productdetail/ProductDetailViewModel.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/notificationsettings/NotificationSettingsViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/notificationsettings/NotificationSettingsViewModel.kt index 7bdc49a7..f4bebdad 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/notificationsettings/NotificationSettingsViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/notificationsettings/NotificationSettingsViewModel.kt @@ -3,7 +3,7 @@ package com.hieuwu.groceriesstore.presentation.notificationsettings import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hieuwu.groceriesstore.core.models.UserModel +import com.hieuwu.groceriesstore.models.UserModel import com.hieuwu.groceriesstore.domain.usecases.GetProfileUseCase import com.hieuwu.groceriesstore.domain.usecases.UserSettingsUseCase import dagger.hilt.android.lifecycle.HiltViewModel diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/orderhistory/OrderListViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/orderhistory/OrderListViewModel.kt index 6fa87b89..dacb4510 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/orderhistory/OrderListViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/orderhistory/OrderListViewModel.kt @@ -2,7 +2,7 @@ package com.hieuwu.groceriesstore.presentation.orderhistory import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hieuwu.groceriesstore.core.models.OrderModel +import com.hieuwu.groceriesstore.models.OrderModel import com.hieuwu.groceriesstore.domain.usecases.GetOrderListUseCase import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.MutableStateFlow diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productdetail/ProductDetailViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productdetail/ProductDetailViewModel.kt index 9e4f7f6a..acc72642 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productdetail/ProductDetailViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productdetail/ProductDetailViewModel.kt @@ -6,7 +6,7 @@ import androidx.lifecycle.viewModelScope import com.hieuwu.groceriesstore.data.database.entities.LineItem import com.hieuwu.groceriesstore.data.database.entities.Order import com.hieuwu.groceriesstore.data.repository.OrderRepository -import com.hieuwu.groceriesstore.core.models.OrderModel +import com.hieuwu.groceriesstore.models.OrderModel import com.hieuwu.groceriesstore.domain.usecases.GetProductDetailUseCase import com.hieuwu.groceriesstore.utilities.OrderStatus import dagger.hilt.android.lifecycle.HiltViewModel From b2724a5d982477af21e4e00711e9ced704b478f1 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sat, 3 Aug 2024 22:30:20 +0700 Subject: [PATCH 17/38] Update package --- .../presentation/productlist/ProductListScreen.kt | 2 +- .../presentation/productlist/ProductListViewModel.kt | 4 ++-- .../presentation/productlist/ProductListViewState.kt | 2 +- .../hieuwu/groceriesstore/presentation/shop/ShopViewModel.kt | 4 ++-- .../presentation/shop/composables/ProductCatalogue.kt | 2 +- .../presentation/shop/composables/ProductItem.kt | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListScreen.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListScreen.kt index f56d5847..00ed0e04 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListScreen.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListScreen.kt @@ -54,7 +54,7 @@ import com.airbnb.lottie.compose.LottieCompositionSpec import com.airbnb.lottie.compose.LottieConstants import com.airbnb.lottie.compose.rememberLottieComposition import com.hieuwu.groceriesstore.R -import com.hieuwu.groceriesstore.core.models.ProductModel +import com.hieuwu.groceriesstore.models.ProductModel import com.hieuwu.groceriesstore.presentation.core.widgets.PrimarySquareIconButton import com.hieuwu.groceriesstore.presentation.core.widgets.WebImage import kotlinx.collections.immutable.ImmutableList diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewModel.kt index a67227c2..91fa9e73 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewModel.kt @@ -5,8 +5,8 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.hieuwu.groceriesstore.data.database.entities.LineItem import com.hieuwu.groceriesstore.data.database.entities.Order -import com.hieuwu.groceriesstore.core.models.OrderModel -import com.hieuwu.groceriesstore.core.models.ProductModel +import com.hieuwu.groceriesstore.models.OrderModel +import com.hieuwu.groceriesstore.models.ProductModel import com.hieuwu.groceriesstore.domain.usecases.AddToCartUseCase import com.hieuwu.groceriesstore.domain.usecases.CreateNewOrderUseCase import com.hieuwu.groceriesstore.domain.usecases.GetCurrentCartUseCase diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewState.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewState.kt index 77ab3860..58ba13f1 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewState.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewState.kt @@ -1,7 +1,7 @@ package com.hieuwu.groceriesstore.presentation.productlist import androidx.compose.runtime.Immutable -import com.hieuwu.groceriesstore.core.models.ProductModel +import com.hieuwu.groceriesstore.models.ProductModel import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentListOf diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/ShopViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/ShopViewModel.kt index 5896afc5..4399c6ad 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/ShopViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/ShopViewModel.kt @@ -4,8 +4,8 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.hieuwu.groceriesstore.data.database.entities.LineItem import com.hieuwu.groceriesstore.data.database.entities.Order -import com.hieuwu.groceriesstore.core.models.OrderModel -import com.hieuwu.groceriesstore.core.models.ProductModel +import com.hieuwu.groceriesstore.models.OrderModel +import com.hieuwu.groceriesstore.models.ProductModel import com.hieuwu.groceriesstore.domain.usecases.AddToCartUseCase import com.hieuwu.groceriesstore.domain.usecases.CreateNewOrderUseCase import com.hieuwu.groceriesstore.domain.usecases.GetCurrentCartUseCase diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/composables/ProductCatalogue.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/composables/ProductCatalogue.kt index ea7ef7cc..5febf67d 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/composables/ProductCatalogue.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/composables/ProductCatalogue.kt @@ -16,7 +16,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import com.hieuwu.groceriesstore.core.models.ProductModel +import com.hieuwu.groceriesstore.models.ProductModel @Composable fun ProductCatalogue( diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/composables/ProductItem.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/composables/ProductItem.kt index 988f7082..697e9251 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/composables/ProductItem.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/composables/ProductItem.kt @@ -29,7 +29,7 @@ import androidx.compose.ui.unit.dp import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi import com.bumptech.glide.integration.compose.GlideImage import com.hieuwu.groceriesstore.R -import com.hieuwu.groceriesstore.core.models.ProductModel +import com.hieuwu.groceriesstore.models.ProductModel @OptIn(ExperimentalGlideComposeApi::class, ExperimentalMaterialApi::class) @Composable From 3b875c64fe984da4c956bc043b2066065a3df3ae Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sat, 3 Aug 2024 22:30:25 +0700 Subject: [PATCH 18/38] Update package --- .../presentation/updateprofile/UpdateProfileScreen.kt | 2 +- .../updateprofile/widgets/UpdateProfileScreenContent.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/UpdateProfileScreen.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/UpdateProfileScreen.kt index ca75b870..d8f36d51 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/UpdateProfileScreen.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/UpdateProfileScreen.kt @@ -8,7 +8,7 @@ import androidx.compose.runtime.collectAsState import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.hilt.navigation.compose.hiltViewModel -import com.hieuwu.groceriesstore.core.models.UserModel +import com.hieuwu.groceriesstore.models.UserModel import com.hieuwu.groceriesstore.presentation.account.DemoUser import com.hieuwu.groceriesstore.presentation.updateprofile.widgets.UpdateProfileAppBar import com.hieuwu.groceriesstore.presentation.updateprofile.widgets.UpdateProfileScreenContent diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/widgets/UpdateProfileScreenContent.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/widgets/UpdateProfileScreenContent.kt index a313e0c0..80cd82ad 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/widgets/UpdateProfileScreenContent.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/widgets/UpdateProfileScreenContent.kt @@ -16,7 +16,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.tooling.preview.Preview import com.hieuwu.groceriesstore.R -import com.hieuwu.groceriesstore.core.models.UserModel +import com.hieuwu.groceriesstore.models.UserModel import com.hieuwu.groceriesstore.presentation.account.DemoUser @Composable From 9f4a4ca23d50166e26217f03adac2216bd041865 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sat, 3 Aug 2024 22:30:30 +0700 Subject: [PATCH 19/38] Update package --- .../presentation/updateprofile/UpdateProfileViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/UpdateProfileViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/UpdateProfileViewModel.kt index 1fb2bb8a..aaff964d 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/UpdateProfileViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/updateprofile/UpdateProfileViewModel.kt @@ -4,7 +4,7 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hieuwu.groceriesstore.core.models.UserModel +import com.hieuwu.groceriesstore.models.UserModel import com.hieuwu.groceriesstore.domain.usecases.GetProfileUseCase import com.hieuwu.groceriesstore.domain.usecases.UpdateProfileUseCase import dagger.hilt.android.lifecycle.HiltViewModel From eec3a6d235aa867d190e84595473d49039807f27 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sat, 3 Aug 2024 22:31:58 +0700 Subject: [PATCH 20/38] Move dependencies module to top --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index a46b8b57..4ca0ca08 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -75,6 +75,7 @@ android { } dependencies { + implementation project(':models') implementation fileTree(dir: "libs", include: ["*.jar"]) implementation libs.bundles.androidx @@ -87,7 +88,6 @@ dependencies { implementation libs.timber implementation libs.bundles.room - implementation project(':models') kapt libs.room.compiler implementation libs.hilt From 8f11c71fefa4e7a0932dbde88a25a53a3ee53a4b Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sun, 4 Aug 2024 20:55:19 +0700 Subject: [PATCH 21/38] Move repository interface to domain --- .../usecases/impl/GetCategoriesListUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/GetCurrentCartUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/GetProductDetailUseCaseImplTest.kt | 2 +- .../usecases/impl/GetProductsByCategoryUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/GetProductsListUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/GetProfileUseCaseImplTest.kt | 3 +-- .../domain/usecases/impl/RefreshAppDataUseCaseImplTest.kt | 6 +++--- .../domain/usecases/impl/SearchProductUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/SignInUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/SignOutUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/SubmitOrderUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/UpdateCartItemUseCaseImplTest.kt | 4 ++-- .../domain/usecases/impl/UpdateProfileUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/UserSettingsUseCaseImplTest.kt | 2 +- 14 files changed, 17 insertions(+), 18 deletions(-) diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImplTest.kt index 36bb3046..f78af148 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImplTest.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.CategoryRepository +import com.hieuwu.groceriesstore.domain.repository.CategoryRepository import com.hieuwu.groceriesstore.models.CategoryModel import com.hieuwu.groceriesstore.domain.usecases.GetCategoriesListUseCase import junit.framework.TestCase.assertEquals diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImplTest.kt index 064de31e..23b19c1b 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImplTest.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.OrderRepository +import com.hieuwu.groceriesstore.domain.repository.OrderRepository import com.hieuwu.groceriesstore.models.OrderModel import com.hieuwu.groceriesstore.domain.usecases.GetCurrentCartUseCase import com.hieuwu.groceriesstore.utilities.OrderStatus diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImplTest.kt index eb73f91b..0811bf66 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImplTest.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.ProductRepository +import com.hieuwu.groceriesstore.domain.repository.ProductRepository import com.hieuwu.groceriesstore.models.ProductModel import com.hieuwu.groceriesstore.domain.usecases.GetProductDetailUseCase import junit.framework.TestCase diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImplTest.kt index 9d9c7394..3a2de006 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImplTest.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.ProductRepository +import com.hieuwu.groceriesstore.domain.repository.ProductRepository import com.hieuwu.groceriesstore.models.ProductModel import com.hieuwu.groceriesstore.domain.usecases.GetProductsByCategoryUseCase import junit.framework.TestCase diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImplTest.kt index 6bab9d01..016e3444 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImplTest.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.ProductRepository +import com.hieuwu.groceriesstore.domain.repository.ProductRepository import com.hieuwu.groceriesstore.models.ProductModel import com.hieuwu.groceriesstore.domain.usecases.GetProductsListUseCase import junit.framework.TestCase.assertEquals diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImplTest.kt index e295f8c8..45e198c1 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImplTest.kt @@ -1,10 +1,9 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.UserRepository +import com.hieuwu.groceriesstore.domain.repository.UserRepository import com.hieuwu.groceriesstore.models.UserModel import com.hieuwu.groceriesstore.domain.usecases.GetProfileUseCase import junit.framework.TestCase.assertEquals -import junit.framework.TestCase.assertNotNull import junit.framework.TestCase.assertNull import junit.framework.TestCase.assertTrue import kotlinx.coroutines.flow.flow diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/RefreshAppDataUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/RefreshAppDataUseCaseImplTest.kt index c5b667ef..57180a21 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/RefreshAppDataUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/RefreshAppDataUseCaseImplTest.kt @@ -1,8 +1,8 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.CategoryRepository -import com.hieuwu.groceriesstore.data.repository.ProductRepository -import com.hieuwu.groceriesstore.data.repository.RecipeRepository +import com.hieuwu.groceriesstore.domain.repository.CategoryRepository +import com.hieuwu.groceriesstore.domain.repository.ProductRepository +import com.hieuwu.groceriesstore.domain.repository.RecipeRepository import com.hieuwu.groceriesstore.domain.usecases.RefreshAppDataUseCase import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runBlocking diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImplTest.kt index 5c611fa3..b843a2e7 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImplTest.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.ProductRepository +import com.hieuwu.groceriesstore.domain.repository.ProductRepository import com.hieuwu.groceriesstore.models.ProductModel import com.hieuwu.groceriesstore.domain.usecases.SearchProductUseCase import junit.framework.TestCase diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignInUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignInUseCaseImplTest.kt index 8b59fcc6..449a5a6a 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignInUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignInUseCaseImplTest.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.UserRepository +import com.hieuwu.groceriesstore.domain.repository.UserRepository import com.hieuwu.groceriesstore.domain.usecases.SignInUseCase import java.util.UUID import kotlinx.coroutines.runBlocking diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignOutUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignOutUseCaseImplTest.kt index 0f2df783..87641e99 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignOutUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignOutUseCaseImplTest.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.UserRepository +import com.hieuwu.groceriesstore.domain.repository.UserRepository import com.hieuwu.groceriesstore.domain.usecases.SignOutUseCase import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runBlocking diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImplTest.kt index 1f267a7b..c16e3a97 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImplTest.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.OrderRepository +import com.hieuwu.groceriesstore.domain.repository.OrderRepository import com.hieuwu.groceriesstore.models.OrderModel import com.hieuwu.groceriesstore.domain.usecases.SubmitOrderUseCase import kotlinx.coroutines.Dispatchers diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImplTest.kt index 3e6b1ae2..66f39213 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImplTest.kt @@ -1,7 +1,7 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.OrderRepository -import com.hieuwu.groceriesstore.data.repository.ProductRepository +import com.hieuwu.groceriesstore.domain.repository.OrderRepository +import com.hieuwu.groceriesstore.domain.repository.ProductRepository import com.hieuwu.groceriesstore.models.LineItemModel import com.hieuwu.groceriesstore.models.OrderModel import com.hieuwu.groceriesstore.domain.usecases.UpdateCartItemUseCase diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateProfileUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateProfileUseCaseImplTest.kt index f183b477..c821468b 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateProfileUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateProfileUseCaseImplTest.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.UserRepository +import com.hieuwu.groceriesstore.domain.repository.UserRepository import com.hieuwu.groceriesstore.domain.usecases.UpdateProfileUseCase import java.util.* import kotlinx.coroutines.runBlocking diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UserSettingsUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UserSettingsUseCaseImplTest.kt index fe567a16..effb859d 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UserSettingsUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UserSettingsUseCaseImplTest.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.UserRepository +import com.hieuwu.groceriesstore.domain.repository.UserRepository import com.hieuwu.groceriesstore.domain.usecases.UserSettingsUseCase import java.util.* import kotlinx.coroutines.Dispatchers From 53dd623daf0a0b0a62092bfed72b523d392d0eb5 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sun, 4 Aug 2024 20:55:28 +0700 Subject: [PATCH 22/38] Restructure --- .../groceriesstore/di/RepositoryModule.kt | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/di/RepositoryModule.kt b/app/src/main/java/com/hieuwu/groceriesstore/di/RepositoryModule.kt index 5ace274f..65a58215 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/di/RepositoryModule.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/di/RepositoryModule.kt @@ -1,17 +1,17 @@ package com.hieuwu.groceriesstore.di -import com.hieuwu.groceriesstore.data.repository.impl.CategoryRepositoryImpl -import com.hieuwu.groceriesstore.data.repository.impl.OrderRepositoryImpl -import com.hieuwu.groceriesstore.data.repository.impl.ProductRepositoryImpl -import com.hieuwu.groceriesstore.data.repository.impl.RecipeRepositoryImpl -import com.hieuwu.groceriesstore.data.repository.impl.UserRepositoryImpl -import com.hieuwu.groceriesstore.data.repository.CategoryRepository -import com.hieuwu.groceriesstore.data.repository.MealPlanRepository -import com.hieuwu.groceriesstore.data.repository.OrderRepository -import com.hieuwu.groceriesstore.data.repository.ProductRepository -import com.hieuwu.groceriesstore.data.repository.RecipeRepository -import com.hieuwu.groceriesstore.data.repository.UserRepository -import com.hieuwu.groceriesstore.data.repository.impl.MealPlanRepositoryImpl +import com.hieuwu.groceriesstore.data.repository.CategoryRepositoryImpl +import com.hieuwu.groceriesstore.data.repository.OrderRepositoryImpl +import com.hieuwu.groceriesstore.data.repository.ProductRepositoryImpl +import com.hieuwu.groceriesstore.data.repository.RecipeRepositoryImpl +import com.hieuwu.groceriesstore.data.repository.UserRepositoryImpl +import com.hieuwu.groceriesstore.domain.repository.CategoryRepository +import com.hieuwu.groceriesstore.domain.repository.MealPlanRepository +import com.hieuwu.groceriesstore.domain.repository.OrderRepository +import com.hieuwu.groceriesstore.domain.repository.ProductRepository +import com.hieuwu.groceriesstore.domain.repository.RecipeRepository +import com.hieuwu.groceriesstore.domain.repository.UserRepository +import com.hieuwu.groceriesstore.data.repository.MealPlanRepositoryImpl import dagger.Binds import dagger.Module import dagger.hilt.InstallIn From 4de51f31a486334e6d95a22fdd1294759f4a8b24 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sun, 4 Aug 2024 20:55:35 +0700 Subject: [PATCH 23/38] Update package --- .../{impl => }/CategoryRepositoryImpl.kt | 80 ++--- .../{impl => }/MealPlanRepositoryImpl.kt | 6 +- .../{impl => }/OrderRepositoryImpl.kt | 230 +++++++------- .../{impl => }/ProductRepositoryImpl.kt | 184 +++++------ .../{impl => }/RecipeRepositoryImpl.kt | 52 +-- .../{impl => }/UserRepositoryImpl.kt | 296 +++++++++--------- 6 files changed, 424 insertions(+), 424 deletions(-) rename app/src/main/java/com/hieuwu/groceriesstore/data/repository/{impl => }/CategoryRepositoryImpl.kt (88%) rename app/src/main/java/com/hieuwu/groceriesstore/data/repository/{impl => }/MealPlanRepositoryImpl.kt (93%) rename app/src/main/java/com/hieuwu/groceriesstore/data/repository/{impl => }/OrderRepositoryImpl.kt (94%) rename app/src/main/java/com/hieuwu/groceriesstore/data/repository/{impl => }/ProductRepositoryImpl.kt (92%) rename app/src/main/java/com/hieuwu/groceriesstore/data/repository/{impl => }/RecipeRepositoryImpl.kt (85%) rename app/src/main/java/com/hieuwu/groceriesstore/data/repository/{impl => }/UserRepositoryImpl.kt (94%) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/CategoryRepositoryImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/CategoryRepositoryImpl.kt similarity index 88% rename from app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/CategoryRepositoryImpl.kt rename to app/src/main/java/com/hieuwu/groceriesstore/data/repository/CategoryRepositoryImpl.kt index 56bacbbe..fc6899d1 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/CategoryRepositoryImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/CategoryRepositoryImpl.kt @@ -1,40 +1,40 @@ -package com.hieuwu.groceriesstore.data.repository.impl - -import com.hieuwu.groceriesstore.data.database.dao.CategoryDao -import com.hieuwu.groceriesstore.data.database.entities.Category -import com.hieuwu.groceriesstore.data.database.entities.asDomainModel -import com.hieuwu.groceriesstore.data.network.RemoteTable -import com.hieuwu.groceriesstore.data.network.dto.CategoriesDto -import com.hieuwu.groceriesstore.data.repository.CategoryRepository -import io.github.jan.supabase.postgrest.Postgrest -import kotlinx.coroutines.flow.map -import timber.log.Timber -import javax.inject.Inject - -class CategoryRepositoryImpl @Inject constructor( - private val categoryDao: CategoryDao, - private val supabasePostgrest: Postgrest -) : - CategoryRepository { - - override suspend fun refreshDatabase() { - try { - val result = supabasePostgrest[RemoteTable.Categories.tableName] - .select() - val res = result.decodeList() - val categories = res.map { it.asEntity() } - categoryDao.insertAll(categories) - } catch (e: Exception) { - Timber.e(e.message) - } - } - - override fun getFromLocal() = categoryDao.getAll().map { it.asDomainModel() } - - private fun CategoriesDto.asEntity(): Category = Category( - id = id, - name = name, - image = image, - ) - -} +package com.hieuwu.groceriesstore.data.repository + +import com.hieuwu.groceriesstore.data.database.dao.CategoryDao +import com.hieuwu.groceriesstore.data.database.entities.Category +import com.hieuwu.groceriesstore.data.database.entities.asDomainModel +import com.hieuwu.groceriesstore.data.network.RemoteTable +import com.hieuwu.groceriesstore.data.network.dto.CategoriesDto +import com.hieuwu.groceriesstore.domain.repository.CategoryRepository +import io.github.jan.supabase.postgrest.Postgrest +import kotlinx.coroutines.flow.map +import timber.log.Timber +import javax.inject.Inject + +class CategoryRepositoryImpl @Inject constructor( + private val categoryDao: CategoryDao, + private val supabasePostgrest: Postgrest +) : + CategoryRepository { + + override suspend fun refreshDatabase() { + try { + val result = supabasePostgrest[RemoteTable.Categories.tableName] + .select() + val res = result.decodeList() + val categories = res.map { it.asEntity() } + categoryDao.insertAll(categories) + } catch (e: Exception) { + Timber.e(e.message) + } + } + + override fun getFromLocal() = categoryDao.getAll().map { it.asDomainModel() } + + private fun CategoriesDto.asEntity(): Category = Category( + id = id, + name = name, + image = image, + ) + +} diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/MealPlanRepositoryImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/MealPlanRepositoryImpl.kt similarity index 93% rename from app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/MealPlanRepositoryImpl.kt rename to app/src/main/java/com/hieuwu/groceriesstore/data/repository/MealPlanRepositoryImpl.kt index 226849d1..27758521 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/MealPlanRepositoryImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/MealPlanRepositoryImpl.kt @@ -1,8 +1,8 @@ -package com.hieuwu.groceriesstore.data.repository.impl +package com.hieuwu.groceriesstore.data.repository import com.hieuwu.groceriesstore.data.network.dto.Meal -import com.hieuwu.groceriesstore.data.repository.MealPlanRepository -import com.hieuwu.groceriesstore.data.repository.UserRepository +import com.hieuwu.groceriesstore.domain.repository.MealPlanRepository +import com.hieuwu.groceriesstore.domain.repository.UserRepository import com.hieuwu.groceriesstore.models.MealModel import com.hieuwu.groceriesstore.utilities.SupabaseHelper import io.github.jan.supabase.postgrest.Postgrest diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/OrderRepositoryImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/OrderRepositoryImpl.kt similarity index 94% rename from app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/OrderRepositoryImpl.kt rename to app/src/main/java/com/hieuwu/groceriesstore/data/repository/OrderRepositoryImpl.kt index 59577b89..cc6fe3df 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/OrderRepositoryImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/OrderRepositoryImpl.kt @@ -1,115 +1,115 @@ -package com.hieuwu.groceriesstore.data.repository.impl - -import com.hieuwu.groceriesstore.data.database.dao.LineItemDao -import com.hieuwu.groceriesstore.data.database.dao.OrderDao -import com.hieuwu.groceriesstore.data.database.entities.LineItem -import com.hieuwu.groceriesstore.data.database.entities.Order -import com.hieuwu.groceriesstore.data.database.entities.asDomainModel -import com.hieuwu.groceriesstore.data.network.dto.OrderDto -import com.hieuwu.groceriesstore.data.repository.OrderRepository -import com.hieuwu.groceriesstore.models.OrderModel -import com.hieuwu.groceriesstore.utilities.OrderStatus -import com.hieuwu.groceriesstore.data.network.RemoteTable -import com.hieuwu.groceriesstore.data.network.dto.LineItemDto -import com.hieuwu.groceriesstore.models.LineItemModel -import io.github.jan.supabase.postgrest.Postgrest -import java.util.Date -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.flow -import kotlinx.coroutines.flow.map -import timber.log.Timber -import javax.inject.Inject - -class OrderRepositoryImpl @Inject constructor( - private val orderDao: OrderDao, - private val lineItemDao: LineItemDao, - private val postgrest: Postgrest -) : OrderRepository { - - override suspend fun createOrUpdate(order: Order) { - try { - orderDao.insert(order) - } catch (e: Exception) { - Timber.e(e.message) - } - } - - override suspend fun addLineItem(lineItem: LineItem) { - try { - lineItemDao.insert(lineItem) - } catch (e: Exception) { - Timber.e(e.message) - } - } - - override fun getOneOrderByStatus(status: OrderStatus): Flow { - return try { - return orderDao.getCartWithLineItems(status.value).map { - it?.asDomainModel() - } - } catch (e: Exception) { - Timber.e(e.message) - flow {} - } - } - - override suspend fun sendOrderToServer(order: OrderModel): Boolean { - val orderDto = mapModelToDto(order) - val lineItems = mapModelListToDto(order) - return try { - postgrest[RemoteTable.Orders.tableName].insert(orderDto) - postgrest[RemoteTable.LineItems.tableName].insert(lineItems) - orderDao.clear() - true - } catch (e: Exception) { - Timber.e(e.message) - false - } - } - - override suspend fun getOrders(): List { - return try { - val result = postgrest[RemoteTable.Orders.tableName].select().decodeList() - result.map { mapToModel(it) } - } catch (e: Exception) { - listOf() - } - } - - private fun mapToModel(order: OrderDto): OrderModel { - return OrderModel( - id = order.orderId, - status = order.status, - address = order.address, - lineItemList = mutableListOf(), - createdAt = order.createdAt - ).apply { - totalPrice = order.total - } - } - - private fun mapModelToDto(order: OrderModel): OrderDto { - return OrderDto( - orderId = order.id, - address = order.address, - status = order.status ?: "", - createdAt = Date().toString(), - total = order.total - ) - } - - private fun mapModelToDto(lineItemModel: LineItemModel, orderId: String): LineItemDto { - return LineItemDto( - id = lineItemModel.id ?: 0, - productId = lineItemModel.productId ?: "", - orderId = orderId, - quantity = lineItemModel.quantity ?: 0, - subtotal = lineItemModel.subtotal ?: 0.0, - lineItemId = lineItemModel.id ?: 0 - ) - } - - private fun mapModelListToDto(order: OrderModel): List { - return order.lineItemList.map { mapModelToDto(it, order.id) } - } -} +package com.hieuwu.groceriesstore.data.repository + +import com.hieuwu.groceriesstore.data.database.dao.LineItemDao +import com.hieuwu.groceriesstore.data.database.dao.OrderDao +import com.hieuwu.groceriesstore.data.database.entities.LineItem +import com.hieuwu.groceriesstore.data.database.entities.Order +import com.hieuwu.groceriesstore.data.database.entities.asDomainModel +import com.hieuwu.groceriesstore.data.network.dto.OrderDto +import com.hieuwu.groceriesstore.domain.repository.OrderRepository +import com.hieuwu.groceriesstore.models.OrderModel +import com.hieuwu.groceriesstore.utilities.OrderStatus +import com.hieuwu.groceriesstore.data.network.RemoteTable +import com.hieuwu.groceriesstore.data.network.dto.LineItemDto +import com.hieuwu.groceriesstore.models.LineItemModel +import io.github.jan.supabase.postgrest.Postgrest +import java.util.Date +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.flow +import kotlinx.coroutines.flow.map +import timber.log.Timber +import javax.inject.Inject + +class OrderRepositoryImpl @Inject constructor( + private val orderDao: OrderDao, + private val lineItemDao: LineItemDao, + private val postgrest: Postgrest +) : OrderRepository { + + override suspend fun createOrUpdate(order: Order) { + try { + orderDao.insert(order) + } catch (e: Exception) { + Timber.e(e.message) + } + } + + override suspend fun addLineItem(lineItem: LineItem) { + try { + lineItemDao.insert(lineItem) + } catch (e: Exception) { + Timber.e(e.message) + } + } + + override fun getOneOrderByStatus(status: OrderStatus): Flow { + return try { + return orderDao.getCartWithLineItems(status.value).map { + it?.asDomainModel() + } + } catch (e: Exception) { + Timber.e(e.message) + flow {} + } + } + + override suspend fun sendOrderToServer(order: OrderModel): Boolean { + val orderDto = mapModelToDto(order) + val lineItems = mapModelListToDto(order) + return try { + postgrest[RemoteTable.Orders.tableName].insert(orderDto) + postgrest[RemoteTable.LineItems.tableName].insert(lineItems) + orderDao.clear() + true + } catch (e: Exception) { + Timber.e(e.message) + false + } + } + + override suspend fun getOrders(): List { + return try { + val result = postgrest[RemoteTable.Orders.tableName].select().decodeList() + result.map { mapToModel(it) } + } catch (e: Exception) { + listOf() + } + } + + private fun mapToModel(order: OrderDto): OrderModel { + return OrderModel( + id = order.orderId, + status = order.status, + address = order.address, + lineItemList = mutableListOf(), + createdAt = order.createdAt + ).apply { + totalPrice = order.total + } + } + + private fun mapModelToDto(order: OrderModel): OrderDto { + return OrderDto( + orderId = order.id, + address = order.address, + status = order.status ?: "", + createdAt = Date().toString(), + total = order.total + ) + } + + private fun mapModelToDto(lineItemModel: LineItemModel, orderId: String): LineItemDto { + return LineItemDto( + id = lineItemModel.id ?: 0, + productId = lineItemModel.productId ?: "", + orderId = orderId, + quantity = lineItemModel.quantity ?: 0, + subtotal = lineItemModel.subtotal ?: 0.0, + lineItemId = lineItemModel.id ?: 0 + ) + } + + private fun mapModelListToDto(order: OrderModel): List { + return order.lineItemList.map { mapModelToDto(it, order.id) } + } +} diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/ProductRepositoryImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/ProductRepositoryImpl.kt similarity index 92% rename from app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/ProductRepositoryImpl.kt rename to app/src/main/java/com/hieuwu/groceriesstore/data/repository/ProductRepositoryImpl.kt index e355044a..09937961 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/ProductRepositoryImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/ProductRepositoryImpl.kt @@ -1,92 +1,92 @@ -package com.hieuwu.groceriesstore.data.repository.impl - -import com.hieuwu.groceriesstore.data.database.dao.LineItemDao -import com.hieuwu.groceriesstore.data.database.dao.ProductDao -import com.hieuwu.groceriesstore.data.database.entities.Product -import com.hieuwu.groceriesstore.data.database.entities.asDomainModel -import com.hieuwu.groceriesstore.data.network.RemoteTable -import com.hieuwu.groceriesstore.data.network.dto.ProductDto -import com.hieuwu.groceriesstore.data.repository.ProductRepository -import com.hieuwu.groceriesstore.models.ProductModel -import io.github.jan.supabase.postgrest.Postgrest -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.flow -import kotlinx.coroutines.flow.map -import timber.log.Timber -import javax.inject.Inject - -class ProductRepositoryImpl @Inject constructor( - private val productDao: ProductDao, - private val lineItemDao: LineItemDao, - private val supabasePostgrest: Postgrest -) : ProductRepository { - - override val products: Flow> = - productDao.getAll().map { - it.asDomainModel() - } - - override suspend fun refreshDatabase() { - try { - val result = supabasePostgrest[RemoteTable.Product.tableName] - .select().decodeList() - val products = result.map { it.asEntity() } - productDao.insertAll(products) - } catch (e: Exception) { - Timber.e(e.message) - } - } - - override suspend fun updateLineItemQuantityById(quantity: Int, id: Long) { - try { - lineItemDao.updateQuantityById(quantity, id) - } catch (e: Exception) { - Timber.e(e.message) - } - } - - override suspend fun removeLineItemById(id: Long) { - try { - lineItemDao.removeLineItemById(id) - } catch (e: Exception) { - Timber.e(e.message) - } - } - - override fun searchProductsListByName(name: String?) = - productDao.searchProductByName(name).map { it.asDomainModel() } - - override fun getAllProductsByCategory(categoryId: String): Flow> { - return try { - productDao.getAllByCategory(categoryId).map { - it.asDomainModel() - } - } catch (e: Exception) { - Timber.e(e.message) - flow {} - } - } - - override fun getProductById(productId: String): Flow { - try { - val productFlow = productDao.getById(productId) - return productFlow.map { - it.asDomainModel() - } - } catch (e: Exception) { - Timber.e(e) - } - return flow {} - } - - private fun ProductDto.asEntity(): Product = Product( - id = productId, - name = name, - nutrition = nutrition, - description = description, - image = image, - price = price, - category = category, - ) - -} +package com.hieuwu.groceriesstore.data.repository + +import com.hieuwu.groceriesstore.data.database.dao.LineItemDao +import com.hieuwu.groceriesstore.data.database.dao.ProductDao +import com.hieuwu.groceriesstore.data.database.entities.Product +import com.hieuwu.groceriesstore.data.database.entities.asDomainModel +import com.hieuwu.groceriesstore.data.network.RemoteTable +import com.hieuwu.groceriesstore.data.network.dto.ProductDto +import com.hieuwu.groceriesstore.domain.repository.ProductRepository +import com.hieuwu.groceriesstore.models.ProductModel +import io.github.jan.supabase.postgrest.Postgrest +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.flow +import kotlinx.coroutines.flow.map +import timber.log.Timber +import javax.inject.Inject + +class ProductRepositoryImpl @Inject constructor( + private val productDao: ProductDao, + private val lineItemDao: LineItemDao, + private val supabasePostgrest: Postgrest +) : ProductRepository { + + override val products: Flow> = + productDao.getAll().map { + it.asDomainModel() + } + + override suspend fun refreshDatabase() { + try { + val result = supabasePostgrest[RemoteTable.Product.tableName] + .select().decodeList() + val products = result.map { it.asEntity() } + productDao.insertAll(products) + } catch (e: Exception) { + Timber.e(e.message) + } + } + + override suspend fun updateLineItemQuantityById(quantity: Int, id: Long) { + try { + lineItemDao.updateQuantityById(quantity, id) + } catch (e: Exception) { + Timber.e(e.message) + } + } + + override suspend fun removeLineItemById(id: Long) { + try { + lineItemDao.removeLineItemById(id) + } catch (e: Exception) { + Timber.e(e.message) + } + } + + override fun searchProductsListByName(name: String?) = + productDao.searchProductByName(name).map { it.asDomainModel() } + + override fun getAllProductsByCategory(categoryId: String): Flow> { + return try { + productDao.getAllByCategory(categoryId).map { + it.asDomainModel() + } + } catch (e: Exception) { + Timber.e(e.message) + flow {} + } + } + + override fun getProductById(productId: String): Flow { + try { + val productFlow = productDao.getById(productId) + return productFlow.map { + it.asDomainModel() + } + } catch (e: Exception) { + Timber.e(e) + } + return flow {} + } + + private fun ProductDto.asEntity(): Product = Product( + id = productId, + name = name, + nutrition = nutrition, + description = description, + image = image, + price = price, + category = category, + ) + +} diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/RecipeRepositoryImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/RecipeRepositoryImpl.kt similarity index 85% rename from app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/RecipeRepositoryImpl.kt rename to app/src/main/java/com/hieuwu/groceriesstore/data/repository/RecipeRepositoryImpl.kt index 9790b16f..bceb2273 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/RecipeRepositoryImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/RecipeRepositoryImpl.kt @@ -1,26 +1,26 @@ -package com.hieuwu.groceriesstore.data.repository.impl - -import com.hieuwu.groceriesstore.data.database.dao.RecipeDao -import com.hieuwu.groceriesstore.data.database.entities.asDomainModel -import com.hieuwu.groceriesstore.data.network.Api -import com.hieuwu.groceriesstore.data.network.dto.asEntity -import com.hieuwu.groceriesstore.data.repository.RecipeRepository -import kotlinx.coroutines.flow.map -import timber.log.Timber -import javax.inject.Inject - -class RecipeRepositoryImpl @Inject constructor( - private val recipeDao: RecipeDao -) : RecipeRepository { - override suspend fun refreshDatabase() { - try { - val getRecipeDeferred = Api.retrofitService.getRecipesList() - val listResult = getRecipeDeferred.await().recipesList.asEntity() - recipeDao.insertAll(listResult) - } catch (e: Exception) { - Timber.e(e.message) - } - } - - override fun getFromLocal() = recipeDao.getAll().map { it.asDomainModel() } -} +package com.hieuwu.groceriesstore.data.repository + +import com.hieuwu.groceriesstore.data.database.dao.RecipeDao +import com.hieuwu.groceriesstore.data.database.entities.asDomainModel +import com.hieuwu.groceriesstore.data.network.Api +import com.hieuwu.groceriesstore.data.network.dto.asEntity +import com.hieuwu.groceriesstore.domain.repository.RecipeRepository +import kotlinx.coroutines.flow.map +import timber.log.Timber +import javax.inject.Inject + +class RecipeRepositoryImpl @Inject constructor( + private val recipeDao: RecipeDao +) : RecipeRepository { + override suspend fun refreshDatabase() { + try { + val getRecipeDeferred = Api.retrofitService.getRecipesList() + val listResult = getRecipeDeferred.await().recipesList.asEntity() + recipeDao.insertAll(listResult) + } catch (e: Exception) { + Timber.e(e.message) + } + } + + override fun getFromLocal() = recipeDao.getAll().map { it.asDomainModel() } +} diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/UserRepositoryImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/UserRepositoryImpl.kt similarity index 94% rename from app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/UserRepositoryImpl.kt rename to app/src/main/java/com/hieuwu/groceriesstore/data/repository/UserRepositoryImpl.kt index a3bcf666..31943694 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/impl/UserRepositoryImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/UserRepositoryImpl.kt @@ -1,148 +1,148 @@ -package com.hieuwu.groceriesstore.data.repository.impl - -import com.hieuwu.groceriesstore.data.database.dao.UserDao -import com.hieuwu.groceriesstore.data.database.entities.User -import com.hieuwu.groceriesstore.data.database.entities.asDomainModel -import com.hieuwu.groceriesstore.data.network.dto.UserDto -import com.hieuwu.groceriesstore.data.repository.UserRepository -import com.hieuwu.groceriesstore.data.network.RemoteTable -import io.github.jan.supabase.gotrue.Auth -import io.github.jan.supabase.gotrue.providers.builtin.Email -import io.github.jan.supabase.postgrest.Postgrest -import java.util.UUID -import kotlinx.coroutines.flow.map -import timber.log.Timber -import javax.inject.Inject - -class UserRepositoryImpl @Inject constructor( - private val userDao: UserDao, - private val authService: Auth, - private val postgrest: Postgrest, -) : UserRepository { - - override suspend fun createAccount(email: String, password: String, name: String): Boolean { - return try { - authService.signUpWith(Email) { - this.email = email - this.password = password - } - val userDto = UserDto( - id = UUID.randomUUID().toString(), - name = name, - email = email, - address = null, - phone = null, - isOrderCreatedNotiEnabled = false, - isPromotionNotiEnabled = false, - isDataRefreshedNotiEnabled = false - ) - postgrest[RemoteTable.Users.tableName].upsert(value = userDto) - val user = userDto.asEntity() - userDao.insert(user) - true - } catch (e: Exception) { - Timber.e(e.message) - false - } - } - - override suspend fun authenticate(email: String, password: String): Boolean { - return try { - authService.signInWith(Email) { - this.email = email - this.password = password - } - - val userDto = postgrest[RemoteTable.Users.tableName].select() - { - filter { - UserDto::email eq email - } - } - .decodeSingle() - val user = userDto.asEntity() - userDao.insert(user) - true - } catch (e: Exception) { - Timber.e(e.message) - false - } - } - - override suspend fun updateUserProfile( - userId: String, - name: String, - email: String, - phone: String, - address: String - ) { - val dbUser = User( - userId, name, email, address, phone, - isOrderCreatedNotiEnabled = false, - isPromotionNotiEnabled = false, - isDataRefreshedNotiEnabled = false - ) - try { - postgrest[RemoteTable.Users.tableName].update( - { - UserDto::phone setTo phone - UserDto::email setTo email - UserDto::address setTo address - } - ) { - UserDto::id to userId - } - userDao.insert(dbUser) - } catch (e: Exception) { - Timber.e(e) - } - } - - override suspend fun clearUser() { - userDao.clearUser() - } - - override suspend fun updateUserSettings( - id: String, - isOrderCreatedEnabled: Boolean, - isDatabaseRefreshedEnabled: Boolean, - isPromotionEnabled: Boolean - ) { - try { - postgrest[RemoteTable.Users.tableName].update( - { - UserDto::isOrderCreatedNotiEnabled setTo isOrderCreatedEnabled - UserDto::isDataRefreshedNotiEnabled setTo isDatabaseRefreshedEnabled - UserDto::isPromotionNotiEnabled setTo isPromotionEnabled - } - ) { - filter { - UserDto::id eq id - } - } - userDao.updateUserSettings( - id, - isOrderCreatedEnabled, - isDatabaseRefreshedEnabled, - isPromotionEnabled - ) - } catch (e: Exception) { - Timber.e(e.message) - } - } - - override fun getCurrentUser() = userDao.getCurrentUser().map { - it?.asDomainModel() - } - - private fun UserDto.asEntity(): User = User( - id = id, - name = name, - email = email, - address = address, - phone = phone, - isDataRefreshedNotiEnabled = isDataRefreshedNotiEnabled, - isOrderCreatedNotiEnabled = isOrderCreatedNotiEnabled, - isPromotionNotiEnabled = isPromotionNotiEnabled, - ) -} +package com.hieuwu.groceriesstore.data.repository + +import com.hieuwu.groceriesstore.data.database.dao.UserDao +import com.hieuwu.groceriesstore.data.database.entities.User +import com.hieuwu.groceriesstore.data.database.entities.asDomainModel +import com.hieuwu.groceriesstore.data.network.dto.UserDto +import com.hieuwu.groceriesstore.domain.repository.UserRepository +import com.hieuwu.groceriesstore.data.network.RemoteTable +import io.github.jan.supabase.gotrue.Auth +import io.github.jan.supabase.gotrue.providers.builtin.Email +import io.github.jan.supabase.postgrest.Postgrest +import java.util.UUID +import kotlinx.coroutines.flow.map +import timber.log.Timber +import javax.inject.Inject + +class UserRepositoryImpl @Inject constructor( + private val userDao: UserDao, + private val authService: Auth, + private val postgrest: Postgrest, +) : UserRepository { + + override suspend fun createAccount(email: String, password: String, name: String): Boolean { + return try { + authService.signUpWith(Email) { + this.email = email + this.password = password + } + val userDto = UserDto( + id = UUID.randomUUID().toString(), + name = name, + email = email, + address = null, + phone = null, + isOrderCreatedNotiEnabled = false, + isPromotionNotiEnabled = false, + isDataRefreshedNotiEnabled = false + ) + postgrest[RemoteTable.Users.tableName].upsert(value = userDto) + val user = userDto.asEntity() + userDao.insert(user) + true + } catch (e: Exception) { + Timber.e(e.message) + false + } + } + + override suspend fun authenticate(email: String, password: String): Boolean { + return try { + authService.signInWith(Email) { + this.email = email + this.password = password + } + + val userDto = postgrest[RemoteTable.Users.tableName].select() + { + filter { + UserDto::email eq email + } + } + .decodeSingle() + val user = userDto.asEntity() + userDao.insert(user) + true + } catch (e: Exception) { + Timber.e(e.message) + false + } + } + + override suspend fun updateUserProfile( + userId: String, + name: String, + email: String, + phone: String, + address: String + ) { + val dbUser = User( + userId, name, email, address, phone, + isOrderCreatedNotiEnabled = false, + isPromotionNotiEnabled = false, + isDataRefreshedNotiEnabled = false + ) + try { + postgrest[RemoteTable.Users.tableName].update( + { + UserDto::phone setTo phone + UserDto::email setTo email + UserDto::address setTo address + } + ) { + UserDto::id to userId + } + userDao.insert(dbUser) + } catch (e: Exception) { + Timber.e(e) + } + } + + override suspend fun clearUser() { + userDao.clearUser() + } + + override suspend fun updateUserSettings( + id: String, + isOrderCreatedEnabled: Boolean, + isDatabaseRefreshedEnabled: Boolean, + isPromotionEnabled: Boolean + ) { + try { + postgrest[RemoteTable.Users.tableName].update( + { + UserDto::isOrderCreatedNotiEnabled setTo isOrderCreatedEnabled + UserDto::isDataRefreshedNotiEnabled setTo isDatabaseRefreshedEnabled + UserDto::isPromotionNotiEnabled setTo isPromotionEnabled + } + ) { + filter { + UserDto::id eq id + } + } + userDao.updateUserSettings( + id, + isOrderCreatedEnabled, + isDatabaseRefreshedEnabled, + isPromotionEnabled + ) + } catch (e: Exception) { + Timber.e(e.message) + } + } + + override fun getCurrentUser() = userDao.getCurrentUser().map { + it?.asDomainModel() + } + + private fun UserDto.asEntity(): User = User( + id = id, + name = name, + email = email, + address = address, + phone = phone, + isDataRefreshedNotiEnabled = isDataRefreshedNotiEnabled, + isOrderCreatedNotiEnabled = isOrderCreatedNotiEnabled, + isPromotionNotiEnabled = isPromotionNotiEnabled, + ) +} From 1b873fa166b995d381b712f84ded08abdd766238 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sun, 4 Aug 2024 20:55:49 +0700 Subject: [PATCH 24/38] Restructure package --- .../repository/CategoryRepository.kt | 18 +++++------ .../repository/MealPlanRepository.kt | 2 +- .../repository/OrderRepository.kt | 32 +++++++++---------- .../repository/ProductRepository.kt | 28 ++++++++-------- .../repository/RecipeRepository.kt | 18 +++++------ .../repository/UserRepository.kt | 32 +++++++++---------- 6 files changed, 65 insertions(+), 65 deletions(-) rename app/src/main/java/com/hieuwu/groceriesstore/{data => domain}/repository/CategoryRepository.kt (77%) rename app/src/main/java/com/hieuwu/groceriesstore/{data => domain}/repository/MealPlanRepository.kt (88%) rename app/src/main/java/com/hieuwu/groceriesstore/{data => domain}/repository/OrderRepository.kt (89%) rename app/src/main/java/com/hieuwu/groceriesstore/{data => domain}/repository/ProductRepository.kt (89%) rename app/src/main/java/com/hieuwu/groceriesstore/{data => domain}/repository/RecipeRepository.kt (77%) rename app/src/main/java/com/hieuwu/groceriesstore/{data => domain}/repository/UserRepository.kt (90%) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/CategoryRepository.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/CategoryRepository.kt similarity index 77% rename from app/src/main/java/com/hieuwu/groceriesstore/data/repository/CategoryRepository.kt rename to app/src/main/java/com/hieuwu/groceriesstore/domain/repository/CategoryRepository.kt index ea92dd49..8d54cb01 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/CategoryRepository.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/CategoryRepository.kt @@ -1,9 +1,9 @@ -package com.hieuwu.groceriesstore.data.repository - -import com.hieuwu.groceriesstore.models.CategoryModel -import kotlinx.coroutines.flow.Flow - -interface CategoryRepository { - suspend fun refreshDatabase() - fun getFromLocal(): Flow> -} +package com.hieuwu.groceriesstore.domain.repository + +import com.hieuwu.groceriesstore.models.CategoryModel +import kotlinx.coroutines.flow.Flow + +interface CategoryRepository { + suspend fun refreshDatabase() + fun getFromLocal(): Flow> +} diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/MealPlanRepository.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/MealPlanRepository.kt similarity index 88% rename from app/src/main/java/com/hieuwu/groceriesstore/data/repository/MealPlanRepository.kt rename to app/src/main/java/com/hieuwu/groceriesstore/domain/repository/MealPlanRepository.kt index e21e38c8..5a2c6377 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/MealPlanRepository.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/MealPlanRepository.kt @@ -1,4 +1,4 @@ -package com.hieuwu.groceriesstore.data.repository +package com.hieuwu.groceriesstore.domain.repository import com.hieuwu.groceriesstore.models.MealModel diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/OrderRepository.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/OrderRepository.kt similarity index 89% rename from app/src/main/java/com/hieuwu/groceriesstore/data/repository/OrderRepository.kt rename to app/src/main/java/com/hieuwu/groceriesstore/domain/repository/OrderRepository.kt index e280a631..9c73d5f2 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/OrderRepository.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/OrderRepository.kt @@ -1,16 +1,16 @@ -package com.hieuwu.groceriesstore.data.repository - -import com.hieuwu.groceriesstore.data.database.entities.LineItem -import com.hieuwu.groceriesstore.data.database.entities.Order -import com.hieuwu.groceriesstore.models.OrderModel -import com.hieuwu.groceriesstore.utilities.OrderStatus -import kotlinx.coroutines.flow.Flow - -interface OrderRepository { - suspend fun createOrUpdate(order: Order) - suspend fun addLineItem(lineItem: LineItem) - fun getOneOrderByStatus(status: OrderStatus): Flow - suspend fun sendOrderToServer(order: OrderModel): Boolean - - suspend fun getOrders(): List -} +package com.hieuwu.groceriesstore.domain.repository + +import com.hieuwu.groceriesstore.data.database.entities.LineItem +import com.hieuwu.groceriesstore.data.database.entities.Order +import com.hieuwu.groceriesstore.models.OrderModel +import com.hieuwu.groceriesstore.utilities.OrderStatus +import kotlinx.coroutines.flow.Flow + +interface OrderRepository { + suspend fun createOrUpdate(order: Order) + suspend fun addLineItem(lineItem: LineItem) + fun getOneOrderByStatus(status: OrderStatus): Flow + suspend fun sendOrderToServer(order: OrderModel): Boolean + + suspend fun getOrders(): List +} diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/ProductRepository.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/ProductRepository.kt similarity index 89% rename from app/src/main/java/com/hieuwu/groceriesstore/data/repository/ProductRepository.kt rename to app/src/main/java/com/hieuwu/groceriesstore/domain/repository/ProductRepository.kt index 059908df..4dadb680 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/ProductRepository.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/ProductRepository.kt @@ -1,14 +1,14 @@ -package com.hieuwu.groceriesstore.data.repository - -import com.hieuwu.groceriesstore.models.ProductModel -import kotlinx.coroutines.flow.Flow - -interface ProductRepository { - val products: Flow> - fun getProductById(productId: String): Flow - fun getAllProductsByCategory(categoryId: String): Flow> - suspend fun refreshDatabase() - suspend fun updateLineItemQuantityById(quantity: Int, id: Long) - suspend fun removeLineItemById(id: Long) - fun searchProductsListByName(name: String?): Flow> -} +package com.hieuwu.groceriesstore.domain.repository + +import com.hieuwu.groceriesstore.models.ProductModel +import kotlinx.coroutines.flow.Flow + +interface ProductRepository { + val products: Flow> + fun getProductById(productId: String): Flow + fun getAllProductsByCategory(categoryId: String): Flow> + suspend fun refreshDatabase() + suspend fun updateLineItemQuantityById(quantity: Int, id: Long) + suspend fun removeLineItemById(id: Long) + fun searchProductsListByName(name: String?): Flow> +} diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/RecipeRepository.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/RecipeRepository.kt similarity index 77% rename from app/src/main/java/com/hieuwu/groceriesstore/data/repository/RecipeRepository.kt rename to app/src/main/java/com/hieuwu/groceriesstore/domain/repository/RecipeRepository.kt index 9e824b63..364dc8d7 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/RecipeRepository.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/RecipeRepository.kt @@ -1,9 +1,9 @@ -package com.hieuwu.groceriesstore.data.repository - -import com.hieuwu.groceriesstore.models.RecipeModel -import kotlinx.coroutines.flow.Flow - -interface RecipeRepository { - suspend fun refreshDatabase() - fun getFromLocal(): Flow> -} +package com.hieuwu.groceriesstore.domain.repository + +import com.hieuwu.groceriesstore.models.RecipeModel +import kotlinx.coroutines.flow.Flow + +interface RecipeRepository { + suspend fun refreshDatabase() + fun getFromLocal(): Flow> +} diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/UserRepository.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/UserRepository.kt similarity index 90% rename from app/src/main/java/com/hieuwu/groceriesstore/data/repository/UserRepository.kt rename to app/src/main/java/com/hieuwu/groceriesstore/domain/repository/UserRepository.kt index 0c949750..83fde2c7 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/UserRepository.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/UserRepository.kt @@ -1,16 +1,16 @@ -package com.hieuwu.groceriesstore.data.repository - -import com.hieuwu.groceriesstore.models.UserModel -import kotlinx.coroutines.flow.Flow - -interface UserRepository { - suspend fun createAccount(email: String, password: String, name: String): Boolean - suspend fun authenticate(email: String, password: String): Boolean - fun getCurrentUser(): Flow - suspend fun updateUserProfile(userId: String, name: String, email: String, phone: String, address: String) - suspend fun clearUser() - suspend fun updateUserSettings( - id: String, isOrderCreatedEnabled: Boolean, isDatabaseRefreshedEnabled: Boolean, - isPromotionEnabled: Boolean - ) -} +package com.hieuwu.groceriesstore.domain.repository + +import com.hieuwu.groceriesstore.models.UserModel +import kotlinx.coroutines.flow.Flow + +interface UserRepository { + suspend fun createAccount(email: String, password: String, name: String): Boolean + suspend fun authenticate(email: String, password: String): Boolean + fun getCurrentUser(): Flow + suspend fun updateUserProfile(userId: String, name: String, email: String, phone: String, address: String) + suspend fun clearUser() + suspend fun updateUserSettings( + id: String, isOrderCreatedEnabled: Boolean, isDatabaseRefreshedEnabled: Boolean, + isPromotionEnabled: Boolean + ) +} From de0a52163365fbb1520d5878a0925abcc63c30b9 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sun, 4 Aug 2024 20:55:59 +0700 Subject: [PATCH 25/38] Update imports --- .../domain/usecases/impl/AddMealToPlanUseCaseImpl.kt | 2 +- .../domain/usecases/impl/AddToCartUseCaseImpl.kt | 2 +- .../domain/usecases/impl/CreateNewOrderUseCaseImpl.kt | 2 +- .../domain/usecases/impl/GetCategoriesListUseCaseImpl.kt | 2 +- .../domain/usecases/impl/GetCurrentCartUseCaseImpl.kt | 2 +- .../domain/usecases/impl/GetOrderListUseCaseImpl.kt | 2 +- .../domain/usecases/impl/GetProductDetailUseCaseImpl.kt | 2 +- .../usecases/impl/GetProductsByCategoryUseCaseImpl.kt | 4 +--- .../domain/usecases/impl/GetProductsListUseCaseImpl.kt | 4 +--- .../domain/usecases/impl/GetProfileUseCaseImpl.kt | 2 +- .../domain/usecases/impl/RefreshAppDataUseCaseImpl.kt | 6 +++--- .../domain/usecases/impl/RemoveMealFromPlanUseCaseImpl.kt | 2 +- .../domain/usecases/impl/RetrieveMealByTypeUseCaseImpl.kt | 7 +------ .../domain/usecases/impl/SearchProductUseCaseImpl.kt | 2 +- .../domain/usecases/impl/SignInUseCaseImpl.kt | 3 +-- .../domain/usecases/impl/SignOutUseCaseImpl.kt | 2 +- .../domain/usecases/impl/SubmitOrderUseCaseImpl.kt | 2 +- .../domain/usecases/impl/UpdateCartItemUseCaseImpl.kt | 4 ++-- .../domain/usecases/impl/UpdateProfileUseCaseImpl.kt | 4 +--- .../domain/usecases/impl/UserSettingsUseCaseImpl.kt | 2 +- 20 files changed, 23 insertions(+), 35 deletions(-) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/AddMealToPlanUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/AddMealToPlanUseCaseImpl.kt index e9ad7a36..23dd9e91 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/AddMealToPlanUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/AddMealToPlanUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.MealPlanRepository +import com.hieuwu.groceriesstore.domain.repository.MealPlanRepository import com.hieuwu.groceriesstore.domain.usecases.AddMealToPlanUseCase import javax.inject.Inject diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/AddToCartUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/AddToCartUseCaseImpl.kt index 0452b988..6803bfca 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/AddToCartUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/AddToCartUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.OrderRepository +import com.hieuwu.groceriesstore.domain.repository.OrderRepository import com.hieuwu.groceriesstore.di.IoDispatcher import com.hieuwu.groceriesstore.domain.usecases.AddToCartUseCase import kotlinx.coroutines.CoroutineDispatcher diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/CreateNewOrderUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/CreateNewOrderUseCaseImpl.kt index de24d369..24c14d92 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/CreateNewOrderUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/CreateNewOrderUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.OrderRepository +import com.hieuwu.groceriesstore.domain.repository.OrderRepository import com.hieuwu.groceriesstore.di.IoDispatcher import com.hieuwu.groceriesstore.domain.usecases.CreateNewOrderUseCase import kotlinx.coroutines.CoroutineDispatcher diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImpl.kt index cc8c8b64..f013a6c5 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.CategoryRepository +import com.hieuwu.groceriesstore.domain.repository.CategoryRepository import com.hieuwu.groceriesstore.domain.usecases.GetCategoriesListUseCase import javax.inject.Inject diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImpl.kt index f6e0b188..24f69b79 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.OrderRepository +import com.hieuwu.groceriesstore.domain.repository.OrderRepository import com.hieuwu.groceriesstore.domain.usecases.GetCurrentCartUseCase import com.hieuwu.groceriesstore.utilities.OrderStatus import javax.inject.Inject diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetOrderListUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetOrderListUseCaseImpl.kt index 90090ba0..f1727fb9 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetOrderListUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetOrderListUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.OrderRepository +import com.hieuwu.groceriesstore.domain.repository.OrderRepository import com.hieuwu.groceriesstore.di.IoDispatcher import com.hieuwu.groceriesstore.domain.usecases.GetOrderListUseCase import kotlinx.coroutines.CoroutineDispatcher diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImpl.kt index a54c30bc..11a177e9 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.ProductRepository +import com.hieuwu.groceriesstore.domain.repository.ProductRepository import com.hieuwu.groceriesstore.domain.usecases.GetProductDetailUseCase import javax.inject.Inject diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImpl.kt index 9a32d5e7..70be6317 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImpl.kt @@ -1,9 +1,7 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.ProductRepository +import com.hieuwu.groceriesstore.domain.repository.ProductRepository import com.hieuwu.groceriesstore.domain.usecases.GetProductsByCategoryUseCase -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.withContext import javax.inject.Inject class GetProductsByCategoryUseCaseImpl @Inject constructor(private val productRepository: ProductRepository) : diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImpl.kt index 557daf00..618b887b 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImpl.kt @@ -1,9 +1,7 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.ProductRepository +import com.hieuwu.groceriesstore.domain.repository.ProductRepository import com.hieuwu.groceriesstore.domain.usecases.GetProductsListUseCase -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.withContext import javax.inject.Inject class GetProductsListUseCaseImpl @Inject constructor(private val productRepository: ProductRepository) : diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImpl.kt index 1525c94d..50026b9e 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.UserRepository +import com.hieuwu.groceriesstore.domain.repository.UserRepository import com.hieuwu.groceriesstore.domain.usecases.GetProfileUseCase import javax.inject.Inject diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RefreshAppDataUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RefreshAppDataUseCaseImpl.kt index d5ce8456..2e933f90 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RefreshAppDataUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RefreshAppDataUseCaseImpl.kt @@ -1,8 +1,8 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.CategoryRepository -import com.hieuwu.groceriesstore.data.repository.ProductRepository -import com.hieuwu.groceriesstore.data.repository.RecipeRepository +import com.hieuwu.groceriesstore.domain.repository.CategoryRepository +import com.hieuwu.groceriesstore.domain.repository.ProductRepository +import com.hieuwu.groceriesstore.domain.repository.RecipeRepository import com.hieuwu.groceriesstore.di.IoDispatcher import com.hieuwu.groceriesstore.domain.usecases.RefreshAppDataUseCase import kotlinx.coroutines.CoroutineDispatcher diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RemoveMealFromPlanUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RemoveMealFromPlanUseCaseImpl.kt index 934eb692..87d8750d 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RemoveMealFromPlanUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RemoveMealFromPlanUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.MealPlanRepository +import com.hieuwu.groceriesstore.domain.repository.MealPlanRepository import com.hieuwu.groceriesstore.di.IoDispatcher import com.hieuwu.groceriesstore.domain.usecases.RemoveMealFromPlanUseCase import kotlinx.coroutines.CoroutineDispatcher diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RetrieveMealByTypeUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RetrieveMealByTypeUseCaseImpl.kt index 73a049bf..6b5bc12e 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RetrieveMealByTypeUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RetrieveMealByTypeUseCaseImpl.kt @@ -1,14 +1,9 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.MealPlanRepository +import com.hieuwu.groceriesstore.domain.repository.MealPlanRepository import com.hieuwu.groceriesstore.di.IoDispatcher -import com.hieuwu.groceriesstore.models.MealModel import com.hieuwu.groceriesstore.domain.usecases.RetrieveMealByTypeUseCase import kotlinx.coroutines.CoroutineDispatcher -import kotlinx.coroutines.flow.first -import kotlinx.coroutines.flow.firstOrNull -import kotlinx.coroutines.flow.flow -import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.withContext import javax.inject.Inject diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImpl.kt index 5dd03c01..ddbcf0ff 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.ProductRepository +import com.hieuwu.groceriesstore.domain.repository.ProductRepository import com.hieuwu.groceriesstore.di.IoDispatcher import com.hieuwu.groceriesstore.domain.usecases.SearchProductUseCase import kotlinx.coroutines.CoroutineDispatcher diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignInUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignInUseCaseImpl.kt index a5803d13..c74364ad 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignInUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignInUseCaseImpl.kt @@ -1,10 +1,9 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.UserRepository +import com.hieuwu.groceriesstore.domain.repository.UserRepository import com.hieuwu.groceriesstore.di.IoDispatcher import com.hieuwu.groceriesstore.domain.usecases.SignInUseCase import kotlinx.coroutines.CoroutineDispatcher -import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import timber.log.Timber import javax.inject.Inject diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignOutUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignOutUseCaseImpl.kt index 372e21ab..a918feb6 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignOutUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignOutUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.UserRepository +import com.hieuwu.groceriesstore.domain.repository.UserRepository import com.hieuwu.groceriesstore.di.IoDispatcher import com.hieuwu.groceriesstore.domain.usecases.SignOutUseCase import kotlinx.coroutines.CoroutineDispatcher diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImpl.kt index d1b8433b..a7e7ede8 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.OrderRepository +import com.hieuwu.groceriesstore.domain.repository.OrderRepository import com.hieuwu.groceriesstore.di.IoDispatcher import com.hieuwu.groceriesstore.domain.usecases.SubmitOrderUseCase import kotlinx.coroutines.CoroutineDispatcher diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImpl.kt index c6a2dd8d..75fee144 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImpl.kt @@ -1,7 +1,7 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.OrderRepository -import com.hieuwu.groceriesstore.data.repository.ProductRepository +import com.hieuwu.groceriesstore.domain.repository.OrderRepository +import com.hieuwu.groceriesstore.domain.repository.ProductRepository import com.hieuwu.groceriesstore.di.IoDispatcher import com.hieuwu.groceriesstore.models.LineItemModel import com.hieuwu.groceriesstore.models.OrderModel diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateProfileUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateProfileUseCaseImpl.kt index 9e21fc19..7c5ee198 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateProfileUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateProfileUseCaseImpl.kt @@ -1,9 +1,7 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.UserRepository -import com.hieuwu.groceriesstore.di.IoDispatcher +import com.hieuwu.groceriesstore.domain.repository.UserRepository import com.hieuwu.groceriesstore.domain.usecases.UpdateProfileUseCase -import kotlinx.coroutines.CoroutineDispatcher import javax.inject.Inject class UpdateProfileUseCaseImpl @Inject constructor( diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UserSettingsUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UserSettingsUseCaseImpl.kt index 0468c3f5..e5ac2b2d 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UserSettingsUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UserSettingsUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.data.repository.UserRepository +import com.hieuwu.groceriesstore.domain.repository.UserRepository import com.hieuwu.groceriesstore.di.IoDispatcher import com.hieuwu.groceriesstore.domain.usecases.UserSettingsUseCase import kotlinx.coroutines.CoroutineDispatcher From 303c40476208533525689b4da1fd1316a2535bdd Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sun, 4 Aug 2024 20:56:40 +0700 Subject: [PATCH 26/38] Update package --- .../presentation/authentication/signup/SignUpViewModel.kt | 2 +- .../groceriesstore/presentation/favourite/FavouriteViewModel.kt | 2 +- .../presentation/productdetail/ProductDetailViewModel.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/authentication/signup/SignUpViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/authentication/signup/SignUpViewModel.kt index 20fb8372..1b8637aa 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/authentication/signup/SignUpViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/authentication/signup/SignUpViewModel.kt @@ -2,7 +2,7 @@ package com.hieuwu.groceriesstore.presentation.authentication.signup import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hieuwu.groceriesstore.data.repository.UserRepository +import com.hieuwu.groceriesstore.domain.repository.UserRepository import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/FavouriteViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/FavouriteViewModel.kt index 9540677f..e1aa8f44 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/FavouriteViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/FavouriteViewModel.kt @@ -5,7 +5,7 @@ import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.asLiveData import androidx.lifecycle.viewModelScope -import com.hieuwu.groceriesstore.data.repository.RecipeRepository +import com.hieuwu.groceriesstore.domain.repository.RecipeRepository import com.hieuwu.groceriesstore.models.RecipeModel import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.SharingStarted diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productdetail/ProductDetailViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productdetail/ProductDetailViewModel.kt index acc72642..d022bf9f 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productdetail/ProductDetailViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productdetail/ProductDetailViewModel.kt @@ -5,7 +5,7 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.hieuwu.groceriesstore.data.database.entities.LineItem import com.hieuwu.groceriesstore.data.database.entities.Order -import com.hieuwu.groceriesstore.data.repository.OrderRepository +import com.hieuwu.groceriesstore.domain.repository.OrderRepository import com.hieuwu.groceriesstore.models.OrderModel import com.hieuwu.groceriesstore.domain.usecases.GetProductDetailUseCase import com.hieuwu.groceriesstore.utilities.OrderStatus From eb1e1c46637eca143f21003613a71472be0d4197 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sun, 4 Aug 2024 21:13:41 +0700 Subject: [PATCH 27/38] Refactor use case and repository --- .../presentation/explore/ExploreViewModel.kt | 36 +++++++++++-------- .../productdetail/ProductDetailViewModel.kt | 12 +++---- .../productlist/ProductListViewModel.kt | 30 ++++++++-------- .../presentation/shop/ShopViewModel.kt | 7 +--- 4 files changed, 43 insertions(+), 42 deletions(-) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreViewModel.kt index 930db94e..db112ad3 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreViewModel.kt @@ -12,6 +12,7 @@ import com.hieuwu.groceriesstore.domain.usecases.CreateNewOrderUseCase import com.hieuwu.groceriesstore.domain.usecases.GetCategoriesListUseCase import com.hieuwu.groceriesstore.domain.usecases.GetCurrentCartUseCase import com.hieuwu.groceriesstore.domain.usecases.SearchProductUseCase +import com.hieuwu.groceriesstore.models.LineItemModel import com.hieuwu.groceriesstore.utilities.OrderStatus import dagger.hilt.android.lifecycle.HiltViewModel import java.util.* @@ -96,26 +97,33 @@ class ExploreViewModel @Inject constructor( // Add to cart val cartId = _currentCart.value!!.id viewModelScope.launch { - val lineItem = LineItem( - productId = product.id, - orderId = cartId, - quantity = 1, - subtotal = product.price!! + addToCartUseCase( + AddToCartUseCase.Input( + productId = product.id, + orderId = cartId, + quantity = 1, + subtotal = product.price!! + ) ) - addToCartUseCase(AddToCartUseCase.Input(lineItem = lineItem)) } } else { val id = UUID.randomUUID().toString() - val newOrder = Order(id, OrderStatus.IN_CART.value, "") viewModelScope.launch { - createNewOrderUseCase(CreateNewOrderUseCase.Input(order = newOrder)) - val lineItem = LineItem( - productId = product.id, - orderId = id, - quantity = 1, - subtotal = product.price!! + createNewOrderUseCase( + CreateNewOrderUseCase.Input( + id = id, + status = OrderStatus.IN_CART.value, + address = "" + ) + ) + addToCartUseCase( + AddToCartUseCase.Input( + productId = product.id, + orderId = id, + quantity = 1, + subtotal = product.price!! + ) ) - addToCartUseCase(AddToCartUseCase.Input(lineItem = lineItem)) } } } diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productdetail/ProductDetailViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productdetail/ProductDetailViewModel.kt index d022bf9f..9d939202 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productdetail/ProductDetailViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productdetail/ProductDetailViewModel.kt @@ -3,7 +3,6 @@ package com.hieuwu.groceriesstore.presentation.productdetail import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hieuwu.groceriesstore.data.database.entities.LineItem import com.hieuwu.groceriesstore.data.database.entities.Order import com.hieuwu.groceriesstore.domain.repository.OrderRepository import com.hieuwu.groceriesstore.models.OrderModel @@ -43,7 +42,7 @@ class ProductDetailViewModel @Inject constructor( init { viewModelScope.launch { - currentCart.collect{} + currentCart.collect {} } } @@ -53,28 +52,25 @@ class ProductDetailViewModel @Inject constructor( if (currentCart.value != null) { // Add to cart val cartId = currentCart.value!!.id - val lineItem = LineItem( + orderRepository.addLineItem( productId = product.value!!.id, orderId = cartId, quantity = _quantity.value, subtotal = subtotal ) - orderRepository.addLineItem(lineItem) } else { val id = UUID.randomUUID().toString() - val newOrder = Order( + orderRepository.createOrUpdate( id = id, status = OrderStatus.IN_CART.value, address = "" ) - orderRepository.createOrUpdate(newOrder) - val lineItem = LineItem( + orderRepository.addLineItem( productId = product.value!!.id, orderId = id, quantity = _quantity.value, subtotal = subtotal ) - orderRepository.addLineItem(lineItem) } } } diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewModel.kt index 91fa9e73..54ec5758 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewModel.kt @@ -82,27 +82,29 @@ class ProductListViewModel @Inject constructor( // Add to cart addToCartUseCase( AddToCartUseCase.Input( - LineItem( - productId = product.id, - orderId = currentCart.value!!.id, - quantity = 1, - subtotal = product.price!! - ) + productId = product.id, + orderId = currentCart.value!!.id, + quantity = 1, + subtotal = product.price!! ) ) } else { // TODO: Move order creation to repository layer, at this point only pass domain object val id = UUID.randomUUID().toString() - val newOrder = Order(id, OrderStatus.IN_CART.value, "") - createNewOrderUseCase(CreateNewOrderUseCase.Input(newOrder)) + createNewOrderUseCase( + CreateNewOrderUseCase.Input( + id = id, + status = OrderStatus.IN_CART.value, + address = "" + ) + ) addToCartUseCase( AddToCartUseCase.Input( - LineItem( - productId = product.id, - orderId = id, - quantity = 1, - subtotal = product.price!! - ) + productId = product.id, + orderId = id, + quantity = 1, + subtotal = product.price!! + ) ) } diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/ShopViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/ShopViewModel.kt index 4399c6ad..1794bb78 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/ShopViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/ShopViewModel.kt @@ -82,12 +82,11 @@ class ShopViewModel @Inject constructor( viewModelScope.launch { addToCartUseCase( AddToCartUseCase.Input( - LineItem( + productId = product.id, orderId = cartId, quantity = 1, subtotal = product.price!! - ) ) ) } @@ -96,21 +95,17 @@ class ShopViewModel @Inject constructor( viewModelScope.launch { createNewOrderUseCase( CreateNewOrderUseCase.Input( - Order( id = id, status = OrderStatus.IN_CART.value, address = "" - ) ) ) addToCartUseCase( AddToCartUseCase.Input( - LineItem( productId = product.id, orderId = id, quantity = 1, subtotal = product.price!! - ) ) ) } From 1f0d664aab0c9f3e3f0fe12b9bf10af21324fb55 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sun, 4 Aug 2024 21:13:47 +0700 Subject: [PATCH 28/38] Refactor use case and repository --- .../domain/repository/OrderRepository.kt | 18 ++++++++++++++---- .../domain/usecases/AddToCartUseCase.kt | 10 +++++++--- .../domain/usecases/CreateNewOrderUseCase.kt | 8 +++++--- .../usecases/impl/AddToCartUseCaseImpl.kt | 8 +++++++- .../usecases/impl/CreateNewOrderUseCaseImpl.kt | 6 +++++- 5 files changed, 38 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/OrderRepository.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/OrderRepository.kt index 9c73d5f2..4bfb89e6 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/OrderRepository.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/OrderRepository.kt @@ -1,14 +1,24 @@ package com.hieuwu.groceriesstore.domain.repository -import com.hieuwu.groceriesstore.data.database.entities.LineItem -import com.hieuwu.groceriesstore.data.database.entities.Order import com.hieuwu.groceriesstore.models.OrderModel import com.hieuwu.groceriesstore.utilities.OrderStatus import kotlinx.coroutines.flow.Flow interface OrderRepository { - suspend fun createOrUpdate(order: Order) - suspend fun addLineItem(lineItem: LineItem) + suspend fun createOrUpdate( + id: String, + status: String, + address: String + ) + + suspend fun addLineItem( + id: Long = 0, + productId: String, + orderId: String, + quantity: Int, + subtotal: Double + ) + fun getOneOrderByStatus(status: OrderStatus): Flow suspend fun sendOrderToServer(order: OrderModel): Boolean diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/AddToCartUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/AddToCartUseCase.kt index 31845ba1..586bdddc 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/AddToCartUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/AddToCartUseCase.kt @@ -1,9 +1,13 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.data.database.entities.LineItem - interface AddToCartUseCase: SuspendUseCase { - class Input (val lineItem: LineItem) + class Input ( + val id: Long = 0, + val productId: String, + val orderId: String, + var quantity: Int, + var subtotal: Double + ) class Output } diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/CreateNewOrderUseCase.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/CreateNewOrderUseCase.kt index 34b3cde4..b659fb1e 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/CreateNewOrderUseCase.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/CreateNewOrderUseCase.kt @@ -1,10 +1,12 @@ package com.hieuwu.groceriesstore.domain.usecases -import com.hieuwu.groceriesstore.data.database.entities.Order - interface CreateNewOrderUseCase : SuspendUseCase { - class Input(val order: Order) + class Input( + val id: String, + var status: String, + var address: String + ) class Output(result: Unit) } diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/AddToCartUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/AddToCartUseCaseImpl.kt index 6803bfca..5fb9c4c7 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/AddToCartUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/AddToCartUseCaseImpl.kt @@ -14,7 +14,13 @@ class AddToCartUseCaseImpl @Inject constructor( AddToCartUseCase { override suspend fun invoke(input: AddToCartUseCase.Input): AddToCartUseCase.Output { withContext(ioDispatcher) { - orderRepository.addLineItem(input.lineItem) + + orderRepository.addLineItem( + productId = input.productId, + orderId = input.orderId, + quantity = input.quantity, + subtotal = input.subtotal + ) } return AddToCartUseCase.Output() } diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/CreateNewOrderUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/CreateNewOrderUseCaseImpl.kt index 24c14d92..75341732 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/CreateNewOrderUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/CreateNewOrderUseCaseImpl.kt @@ -14,7 +14,11 @@ class CreateNewOrderUseCaseImpl @Inject constructor( CreateNewOrderUseCase { override suspend fun invoke(input: CreateNewOrderUseCase.Input): CreateNewOrderUseCase.Output { return withContext(ioDispatcher) { - val result = orderRepository.createOrUpdate(input.order) + val result = orderRepository.createOrUpdate( + id = input.id, + status = input.status, + address = input.address + ) CreateNewOrderUseCase.Output(result) } } From e28d06cc1bd9559be5bca7bab456fc1fe65d1b87 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sun, 4 Aug 2024 21:13:56 +0700 Subject: [PATCH 29/38] Refactor use case and repository --- .../data/repository/OrderRepositoryImpl.kt | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/OrderRepositoryImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/OrderRepositoryImpl.kt index cc6fe3df..c1ffe52b 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/OrderRepositoryImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/OrderRepositoryImpl.kt @@ -25,18 +25,38 @@ class OrderRepositoryImpl @Inject constructor( private val lineItemDao: LineItemDao, private val postgrest: Postgrest ) : OrderRepository { - - override suspend fun createOrUpdate(order: Order) { + override suspend fun createOrUpdate( + id: String, + status: String, + address: String + ) { try { + val order = Order( + id = id, + status = status, + address = address + ) orderDao.insert(order) } catch (e: Exception) { Timber.e(e.message) } } - override suspend fun addLineItem(lineItem: LineItem) { + override suspend fun addLineItem( + id: Long, + productId: String, + orderId: String, + quantity: Int, + subtotal: Double + ) { try { - lineItemDao.insert(lineItem) + val newLineItem = LineItem( + productId = productId, + orderId = orderId, + quantity = quantity, + subtotal = subtotal + ) + lineItemDao.insert(newLineItem) } catch (e: Exception) { Timber.e(e.message) } From 6db2132bf783bf4161546199e997e639eb07e599 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sun, 4 Aug 2024 21:14:20 +0700 Subject: [PATCH 30/38] Remove unused imports --- .../presentation/productlist/ProductListViewModel.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewModel.kt index 54ec5758..3976ccd4 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewModel.kt @@ -3,8 +3,6 @@ package com.hieuwu.groceriesstore.presentation.productlist import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hieuwu.groceriesstore.data.database.entities.LineItem -import com.hieuwu.groceriesstore.data.database.entities.Order import com.hieuwu.groceriesstore.models.OrderModel import com.hieuwu.groceriesstore.models.ProductModel import com.hieuwu.groceriesstore.domain.usecases.AddToCartUseCase From 5a70fcf2912c37c26d6df1b50cd31008ffc804f1 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sun, 4 Aug 2024 21:25:22 +0700 Subject: [PATCH 31/38] Move repository interface to domain --- .../main/java/com/hieuwu/groceriesstore/models/OrderStatus.kt | 3 +++ .../hieuwu/groceriesstore}/repository/CategoryRepository.kt | 2 +- .../hieuwu/groceriesstore}/repository/MealPlanRepository.kt | 2 +- .../com/hieuwu/groceriesstore}/repository/OrderRepository.kt | 4 ++-- .../hieuwu/groceriesstore}/repository/ProductRepository.kt | 2 +- .../com/hieuwu/groceriesstore}/repository/RecipeRepository.kt | 2 +- .../com/hieuwu/groceriesstore}/repository/UserRepository.kt | 2 +- 7 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 models/src/main/java/com/hieuwu/groceriesstore/models/OrderStatus.kt rename {app/src/main/java/com/hieuwu/groceriesstore/domain => models/src/main/java/com/hieuwu/groceriesstore}/repository/CategoryRepository.kt (80%) rename {app/src/main/java/com/hieuwu/groceriesstore/domain => models/src/main/java/com/hieuwu/groceriesstore}/repository/MealPlanRepository.kt (88%) rename {app/src/main/java/com/hieuwu/groceriesstore/domain => models/src/main/java/com/hieuwu/groceriesstore}/repository/OrderRepository.kt (83%) rename {app/src/main/java/com/hieuwu/groceriesstore/domain => models/src/main/java/com/hieuwu/groceriesstore}/repository/ProductRepository.kt (91%) rename {app/src/main/java/com/hieuwu/groceriesstore/domain => models/src/main/java/com/hieuwu/groceriesstore}/repository/RecipeRepository.kt (79%) rename {app/src/main/java/com/hieuwu/groceriesstore/domain => models/src/main/java/com/hieuwu/groceriesstore}/repository/UserRepository.kt (92%) diff --git a/models/src/main/java/com/hieuwu/groceriesstore/models/OrderStatus.kt b/models/src/main/java/com/hieuwu/groceriesstore/models/OrderStatus.kt new file mode 100644 index 00000000..197b4dad --- /dev/null +++ b/models/src/main/java/com/hieuwu/groceriesstore/models/OrderStatus.kt @@ -0,0 +1,3 @@ +package com.hieuwu.groceriesstore.models + +enum class OrderStatus(val value: String) { IN_CART("cart"), COMPLETED("completed") } diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/CategoryRepository.kt b/models/src/main/java/com/hieuwu/groceriesstore/repository/CategoryRepository.kt similarity index 80% rename from app/src/main/java/com/hieuwu/groceriesstore/domain/repository/CategoryRepository.kt rename to models/src/main/java/com/hieuwu/groceriesstore/repository/CategoryRepository.kt index 8d54cb01..ce1ffafd 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/CategoryRepository.kt +++ b/models/src/main/java/com/hieuwu/groceriesstore/repository/CategoryRepository.kt @@ -1,4 +1,4 @@ -package com.hieuwu.groceriesstore.domain.repository +package com.hieuwu.groceriesstore.repository import com.hieuwu.groceriesstore.models.CategoryModel import kotlinx.coroutines.flow.Flow diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/MealPlanRepository.kt b/models/src/main/java/com/hieuwu/groceriesstore/repository/MealPlanRepository.kt similarity index 88% rename from app/src/main/java/com/hieuwu/groceriesstore/domain/repository/MealPlanRepository.kt rename to models/src/main/java/com/hieuwu/groceriesstore/repository/MealPlanRepository.kt index 5a2c6377..d77841fd 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/MealPlanRepository.kt +++ b/models/src/main/java/com/hieuwu/groceriesstore/repository/MealPlanRepository.kt @@ -1,4 +1,4 @@ -package com.hieuwu.groceriesstore.domain.repository +package com.hieuwu.groceriesstore.repository import com.hieuwu.groceriesstore.models.MealModel diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/OrderRepository.kt b/models/src/main/java/com/hieuwu/groceriesstore/repository/OrderRepository.kt similarity index 83% rename from app/src/main/java/com/hieuwu/groceriesstore/domain/repository/OrderRepository.kt rename to models/src/main/java/com/hieuwu/groceriesstore/repository/OrderRepository.kt index 4bfb89e6..2ac3f6a6 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/OrderRepository.kt +++ b/models/src/main/java/com/hieuwu/groceriesstore/repository/OrderRepository.kt @@ -1,7 +1,7 @@ -package com.hieuwu.groceriesstore.domain.repository +package com.hieuwu.groceriesstore.repository import com.hieuwu.groceriesstore.models.OrderModel -import com.hieuwu.groceriesstore.utilities.OrderStatus +import com.hieuwu.groceriesstore.models.OrderStatus import kotlinx.coroutines.flow.Flow interface OrderRepository { diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/ProductRepository.kt b/models/src/main/java/com/hieuwu/groceriesstore/repository/ProductRepository.kt similarity index 91% rename from app/src/main/java/com/hieuwu/groceriesstore/domain/repository/ProductRepository.kt rename to models/src/main/java/com/hieuwu/groceriesstore/repository/ProductRepository.kt index 4dadb680..fae8540f 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/ProductRepository.kt +++ b/models/src/main/java/com/hieuwu/groceriesstore/repository/ProductRepository.kt @@ -1,4 +1,4 @@ -package com.hieuwu.groceriesstore.domain.repository +package com.hieuwu.groceriesstore.repository import com.hieuwu.groceriesstore.models.ProductModel import kotlinx.coroutines.flow.Flow diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/RecipeRepository.kt b/models/src/main/java/com/hieuwu/groceriesstore/repository/RecipeRepository.kt similarity index 79% rename from app/src/main/java/com/hieuwu/groceriesstore/domain/repository/RecipeRepository.kt rename to models/src/main/java/com/hieuwu/groceriesstore/repository/RecipeRepository.kt index 364dc8d7..44827347 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/RecipeRepository.kt +++ b/models/src/main/java/com/hieuwu/groceriesstore/repository/RecipeRepository.kt @@ -1,4 +1,4 @@ -package com.hieuwu.groceriesstore.domain.repository +package com.hieuwu.groceriesstore.repository import com.hieuwu.groceriesstore.models.RecipeModel import kotlinx.coroutines.flow.Flow diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/UserRepository.kt b/models/src/main/java/com/hieuwu/groceriesstore/repository/UserRepository.kt similarity index 92% rename from app/src/main/java/com/hieuwu/groceriesstore/domain/repository/UserRepository.kt rename to models/src/main/java/com/hieuwu/groceriesstore/repository/UserRepository.kt index 83fde2c7..ff255d6d 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/repository/UserRepository.kt +++ b/models/src/main/java/com/hieuwu/groceriesstore/repository/UserRepository.kt @@ -1,4 +1,4 @@ -package com.hieuwu.groceriesstore.domain.repository +package com.hieuwu.groceriesstore.repository import com.hieuwu.groceriesstore.models.UserModel import kotlinx.coroutines.flow.Flow From 097bfadf21cf7ace5bb25dde1bd0b38e63c256fc Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sun, 4 Aug 2024 21:25:47 +0700 Subject: [PATCH 32/38] Add dependency for lib --- models/build.gradle.kts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/models/build.gradle.kts b/models/build.gradle.kts index 623addac..58e6b6a8 100644 --- a/models/build.gradle.kts +++ b/models/build.gradle.kts @@ -6,4 +6,8 @@ plugins { java { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 +} + +dependencies { + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0") } \ No newline at end of file From ebd968fd7a4fed63e8597361dcfcdbc357ffd090 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sun, 4 Aug 2024 21:25:54 +0700 Subject: [PATCH 33/38] Update tests --- .../usecases/impl/GetCategoriesListUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/GetCurrentCartUseCaseImplTest.kt | 4 ++-- .../domain/usecases/impl/GetProductDetailUseCaseImplTest.kt | 2 +- .../usecases/impl/GetProductsByCategoryUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/GetProductsListUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/GetProfileUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/RefreshAppDataUseCaseImplTest.kt | 6 +++--- .../domain/usecases/impl/SearchProductUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/SignInUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/SignOutUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/SubmitOrderUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/UpdateCartItemUseCaseImplTest.kt | 6 +++--- .../domain/usecases/impl/UpdateProfileUseCaseImplTest.kt | 2 +- .../domain/usecases/impl/UserSettingsUseCaseImplTest.kt | 2 +- 14 files changed, 19 insertions(+), 19 deletions(-) diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImplTest.kt index f78af148..f433800e 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImplTest.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.CategoryRepository +import com.hieuwu.groceriesstore.repository.CategoryRepository import com.hieuwu.groceriesstore.models.CategoryModel import com.hieuwu.groceriesstore.domain.usecases.GetCategoriesListUseCase import junit.framework.TestCase.assertEquals diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImplTest.kt index 23b19c1b..032fcbf2 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImplTest.kt @@ -1,9 +1,9 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.OrderRepository +import com.hieuwu.groceriesstore.repository.OrderRepository import com.hieuwu.groceriesstore.models.OrderModel import com.hieuwu.groceriesstore.domain.usecases.GetCurrentCartUseCase -import com.hieuwu.groceriesstore.utilities.OrderStatus +import com.hieuwu.groceriesstore.models.OrderStatus import junit.framework.TestCase.assertEquals import junit.framework.TestCase.assertNull import kotlinx.coroutines.flow.flow diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImplTest.kt index 0811bf66..5974a9f4 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImplTest.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.ProductRepository +import com.hieuwu.groceriesstore.repository.ProductRepository import com.hieuwu.groceriesstore.models.ProductModel import com.hieuwu.groceriesstore.domain.usecases.GetProductDetailUseCase import junit.framework.TestCase diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImplTest.kt index 3a2de006..e7345000 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImplTest.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.ProductRepository +import com.hieuwu.groceriesstore.repository.ProductRepository import com.hieuwu.groceriesstore.models.ProductModel import com.hieuwu.groceriesstore.domain.usecases.GetProductsByCategoryUseCase import junit.framework.TestCase diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImplTest.kt index 016e3444..6c30faf8 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImplTest.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.ProductRepository +import com.hieuwu.groceriesstore.repository.ProductRepository import com.hieuwu.groceriesstore.models.ProductModel import com.hieuwu.groceriesstore.domain.usecases.GetProductsListUseCase import junit.framework.TestCase.assertEquals diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImplTest.kt index 45e198c1..5037c535 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImplTest.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.UserRepository +import com.hieuwu.groceriesstore.repository.UserRepository import com.hieuwu.groceriesstore.models.UserModel import com.hieuwu.groceriesstore.domain.usecases.GetProfileUseCase import junit.framework.TestCase.assertEquals diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/RefreshAppDataUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/RefreshAppDataUseCaseImplTest.kt index 57180a21..ea154868 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/RefreshAppDataUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/RefreshAppDataUseCaseImplTest.kt @@ -1,8 +1,8 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.CategoryRepository -import com.hieuwu.groceriesstore.domain.repository.ProductRepository -import com.hieuwu.groceriesstore.domain.repository.RecipeRepository +import com.hieuwu.groceriesstore.repository.CategoryRepository +import com.hieuwu.groceriesstore.repository.ProductRepository +import com.hieuwu.groceriesstore.repository.RecipeRepository import com.hieuwu.groceriesstore.domain.usecases.RefreshAppDataUseCase import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runBlocking diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImplTest.kt index b843a2e7..f4db69d0 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImplTest.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.ProductRepository +import com.hieuwu.groceriesstore.repository.ProductRepository import com.hieuwu.groceriesstore.models.ProductModel import com.hieuwu.groceriesstore.domain.usecases.SearchProductUseCase import junit.framework.TestCase diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignInUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignInUseCaseImplTest.kt index 449a5a6a..2fd07563 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignInUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignInUseCaseImplTest.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.UserRepository +import com.hieuwu.groceriesstore.repository.UserRepository import com.hieuwu.groceriesstore.domain.usecases.SignInUseCase import java.util.UUID import kotlinx.coroutines.runBlocking diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignOutUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignOutUseCaseImplTest.kt index 87641e99..8de4cd14 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignOutUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignOutUseCaseImplTest.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.UserRepository +import com.hieuwu.groceriesstore.repository.UserRepository import com.hieuwu.groceriesstore.domain.usecases.SignOutUseCase import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runBlocking diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImplTest.kt index c16e3a97..baa5c22a 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImplTest.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.OrderRepository +import com.hieuwu.groceriesstore.repository.OrderRepository import com.hieuwu.groceriesstore.models.OrderModel import com.hieuwu.groceriesstore.domain.usecases.SubmitOrderUseCase import kotlinx.coroutines.Dispatchers diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImplTest.kt index 66f39213..bf719ed1 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImplTest.kt @@ -1,11 +1,11 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.OrderRepository -import com.hieuwu.groceriesstore.domain.repository.ProductRepository +import com.hieuwu.groceriesstore.repository.OrderRepository +import com.hieuwu.groceriesstore.repository.ProductRepository import com.hieuwu.groceriesstore.models.LineItemModel import com.hieuwu.groceriesstore.models.OrderModel import com.hieuwu.groceriesstore.domain.usecases.UpdateCartItemUseCase -import com.hieuwu.groceriesstore.utilities.OrderStatus +import com.hieuwu.groceriesstore.models.OrderStatus import junit.framework.TestCase import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.flow diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateProfileUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateProfileUseCaseImplTest.kt index c821468b..f41a09d6 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateProfileUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateProfileUseCaseImplTest.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.UserRepository +import com.hieuwu.groceriesstore.repository.UserRepository import com.hieuwu.groceriesstore.domain.usecases.UpdateProfileUseCase import java.util.* import kotlinx.coroutines.runBlocking diff --git a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UserSettingsUseCaseImplTest.kt b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UserSettingsUseCaseImplTest.kt index effb859d..c78e63bf 100644 --- a/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UserSettingsUseCaseImplTest.kt +++ b/app/src/test/java/com/hieuwu/groceriesstore/domain/usecases/impl/UserSettingsUseCaseImplTest.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.UserRepository +import com.hieuwu.groceriesstore.repository.UserRepository import com.hieuwu.groceriesstore.domain.usecases.UserSettingsUseCase import java.util.* import kotlinx.coroutines.Dispatchers From e9b57591407978932b247e218877151e526b0c62 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sun, 4 Aug 2024 21:26:22 +0700 Subject: [PATCH 34/38] Refactor use case to use new repository --- .../data/repository/CategoryRepositoryImpl.kt | 2 +- .../data/repository/MealPlanRepositoryImpl.kt | 4 ++-- .../data/repository/OrderRepositoryImpl.kt | 4 ++-- .../data/repository/ProductRepositoryImpl.kt | 2 +- .../data/repository/RecipeRepositoryImpl.kt | 2 +- .../data/repository/UserRepositoryImpl.kt | 2 +- .../com/hieuwu/groceriesstore/di/RepositoryModule.kt | 12 ++++++------ .../domain/usecases/impl/AddMealToPlanUseCaseImpl.kt | 2 +- .../domain/usecases/impl/AddToCartUseCaseImpl.kt | 2 +- .../usecases/impl/CreateNewOrderUseCaseImpl.kt | 2 +- .../usecases/impl/GetCategoriesListUseCaseImpl.kt | 2 +- .../usecases/impl/GetCurrentCartUseCaseImpl.kt | 4 ++-- .../domain/usecases/impl/GetOrderListUseCaseImpl.kt | 2 +- .../usecases/impl/GetProductDetailUseCaseImpl.kt | 2 +- .../impl/GetProductsByCategoryUseCaseImpl.kt | 2 +- .../usecases/impl/GetProductsListUseCaseImpl.kt | 2 +- .../domain/usecases/impl/GetProfileUseCaseImpl.kt | 2 +- .../usecases/impl/RefreshAppDataUseCaseImpl.kt | 6 +++--- .../usecases/impl/RemoveMealFromPlanUseCaseImpl.kt | 2 +- .../usecases/impl/RetrieveMealByTypeUseCaseImpl.kt | 2 +- .../domain/usecases/impl/SearchProductUseCaseImpl.kt | 2 +- .../domain/usecases/impl/SignInUseCaseImpl.kt | 2 +- .../domain/usecases/impl/SignOutUseCaseImpl.kt | 2 +- .../domain/usecases/impl/SubmitOrderUseCaseImpl.kt | 2 +- .../usecases/impl/UpdateCartItemUseCaseImpl.kt | 6 +++--- .../domain/usecases/impl/UpdateProfileUseCaseImpl.kt | 2 +- .../domain/usecases/impl/UserSettingsUseCaseImpl.kt | 2 +- .../authentication/signup/SignUpViewModel.kt | 2 +- .../presentation/explore/ExploreViewModel.kt | 2 +- .../presentation/favourite/FavouriteViewModel.kt | 2 +- .../productdetail/ProductDetailViewModel.kt | 5 ++--- .../presentation/productlist/ProductListViewModel.kt | 2 +- .../presentation/shop/ShopViewModel.kt | 2 +- .../com/hieuwu/groceriesstore/utilities/Utilities.kt | 2 -- 34 files changed, 46 insertions(+), 49 deletions(-) diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/CategoryRepositoryImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/CategoryRepositoryImpl.kt index fc6899d1..dec6ec79 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/CategoryRepositoryImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/CategoryRepositoryImpl.kt @@ -5,7 +5,7 @@ import com.hieuwu.groceriesstore.data.database.entities.Category import com.hieuwu.groceriesstore.data.database.entities.asDomainModel import com.hieuwu.groceriesstore.data.network.RemoteTable import com.hieuwu.groceriesstore.data.network.dto.CategoriesDto -import com.hieuwu.groceriesstore.domain.repository.CategoryRepository +import com.hieuwu.groceriesstore.repository.CategoryRepository import io.github.jan.supabase.postgrest.Postgrest import kotlinx.coroutines.flow.map import timber.log.Timber diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/MealPlanRepositoryImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/MealPlanRepositoryImpl.kt index 27758521..485e90e2 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/MealPlanRepositoryImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/MealPlanRepositoryImpl.kt @@ -1,8 +1,8 @@ package com.hieuwu.groceriesstore.data.repository import com.hieuwu.groceriesstore.data.network.dto.Meal -import com.hieuwu.groceriesstore.domain.repository.MealPlanRepository -import com.hieuwu.groceriesstore.domain.repository.UserRepository +import com.hieuwu.groceriesstore.repository.MealPlanRepository +import com.hieuwu.groceriesstore.repository.UserRepository import com.hieuwu.groceriesstore.models.MealModel import com.hieuwu.groceriesstore.utilities.SupabaseHelper import io.github.jan.supabase.postgrest.Postgrest diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/OrderRepositoryImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/OrderRepositoryImpl.kt index c1ffe52b..e6b520e9 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/OrderRepositoryImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/OrderRepositoryImpl.kt @@ -6,12 +6,12 @@ import com.hieuwu.groceriesstore.data.database.entities.LineItem import com.hieuwu.groceriesstore.data.database.entities.Order import com.hieuwu.groceriesstore.data.database.entities.asDomainModel import com.hieuwu.groceriesstore.data.network.dto.OrderDto -import com.hieuwu.groceriesstore.domain.repository.OrderRepository +import com.hieuwu.groceriesstore.repository.OrderRepository import com.hieuwu.groceriesstore.models.OrderModel -import com.hieuwu.groceriesstore.utilities.OrderStatus import com.hieuwu.groceriesstore.data.network.RemoteTable import com.hieuwu.groceriesstore.data.network.dto.LineItemDto import com.hieuwu.groceriesstore.models.LineItemModel +import com.hieuwu.groceriesstore.models.OrderStatus import io.github.jan.supabase.postgrest.Postgrest import java.util.Date import kotlinx.coroutines.flow.Flow diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/ProductRepositoryImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/ProductRepositoryImpl.kt index 09937961..99d5b6aa 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/ProductRepositoryImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/ProductRepositoryImpl.kt @@ -6,7 +6,7 @@ import com.hieuwu.groceriesstore.data.database.entities.Product import com.hieuwu.groceriesstore.data.database.entities.asDomainModel import com.hieuwu.groceriesstore.data.network.RemoteTable import com.hieuwu.groceriesstore.data.network.dto.ProductDto -import com.hieuwu.groceriesstore.domain.repository.ProductRepository +import com.hieuwu.groceriesstore.repository.ProductRepository import com.hieuwu.groceriesstore.models.ProductModel import io.github.jan.supabase.postgrest.Postgrest import kotlinx.coroutines.flow.Flow diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/RecipeRepositoryImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/RecipeRepositoryImpl.kt index bceb2273..bb17f9fb 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/RecipeRepositoryImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/RecipeRepositoryImpl.kt @@ -4,7 +4,7 @@ import com.hieuwu.groceriesstore.data.database.dao.RecipeDao import com.hieuwu.groceriesstore.data.database.entities.asDomainModel import com.hieuwu.groceriesstore.data.network.Api import com.hieuwu.groceriesstore.data.network.dto.asEntity -import com.hieuwu.groceriesstore.domain.repository.RecipeRepository +import com.hieuwu.groceriesstore.repository.RecipeRepository import kotlinx.coroutines.flow.map import timber.log.Timber import javax.inject.Inject diff --git a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/UserRepositoryImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/UserRepositoryImpl.kt index 31943694..8203130b 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/data/repository/UserRepositoryImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/data/repository/UserRepositoryImpl.kt @@ -4,7 +4,7 @@ import com.hieuwu.groceriesstore.data.database.dao.UserDao import com.hieuwu.groceriesstore.data.database.entities.User import com.hieuwu.groceriesstore.data.database.entities.asDomainModel import com.hieuwu.groceriesstore.data.network.dto.UserDto -import com.hieuwu.groceriesstore.domain.repository.UserRepository +import com.hieuwu.groceriesstore.repository.UserRepository import com.hieuwu.groceriesstore.data.network.RemoteTable import io.github.jan.supabase.gotrue.Auth import io.github.jan.supabase.gotrue.providers.builtin.Email diff --git a/app/src/main/java/com/hieuwu/groceriesstore/di/RepositoryModule.kt b/app/src/main/java/com/hieuwu/groceriesstore/di/RepositoryModule.kt index 65a58215..33e36f45 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/di/RepositoryModule.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/di/RepositoryModule.kt @@ -5,12 +5,12 @@ import com.hieuwu.groceriesstore.data.repository.OrderRepositoryImpl import com.hieuwu.groceriesstore.data.repository.ProductRepositoryImpl import com.hieuwu.groceriesstore.data.repository.RecipeRepositoryImpl import com.hieuwu.groceriesstore.data.repository.UserRepositoryImpl -import com.hieuwu.groceriesstore.domain.repository.CategoryRepository -import com.hieuwu.groceriesstore.domain.repository.MealPlanRepository -import com.hieuwu.groceriesstore.domain.repository.OrderRepository -import com.hieuwu.groceriesstore.domain.repository.ProductRepository -import com.hieuwu.groceriesstore.domain.repository.RecipeRepository -import com.hieuwu.groceriesstore.domain.repository.UserRepository +import com.hieuwu.groceriesstore.repository.CategoryRepository +import com.hieuwu.groceriesstore.repository.MealPlanRepository +import com.hieuwu.groceriesstore.repository.OrderRepository +import com.hieuwu.groceriesstore.repository.ProductRepository +import com.hieuwu.groceriesstore.repository.RecipeRepository +import com.hieuwu.groceriesstore.repository.UserRepository import com.hieuwu.groceriesstore.data.repository.MealPlanRepositoryImpl import dagger.Binds import dagger.Module diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/AddMealToPlanUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/AddMealToPlanUseCaseImpl.kt index 23dd9e91..77ada341 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/AddMealToPlanUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/AddMealToPlanUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.MealPlanRepository +import com.hieuwu.groceriesstore.repository.MealPlanRepository import com.hieuwu.groceriesstore.domain.usecases.AddMealToPlanUseCase import javax.inject.Inject diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/AddToCartUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/AddToCartUseCaseImpl.kt index 5fb9c4c7..509139c5 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/AddToCartUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/AddToCartUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.OrderRepository +import com.hieuwu.groceriesstore.repository.OrderRepository import com.hieuwu.groceriesstore.di.IoDispatcher import com.hieuwu.groceriesstore.domain.usecases.AddToCartUseCase import kotlinx.coroutines.CoroutineDispatcher diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/CreateNewOrderUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/CreateNewOrderUseCaseImpl.kt index 75341732..64e50624 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/CreateNewOrderUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/CreateNewOrderUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.OrderRepository +import com.hieuwu.groceriesstore.repository.OrderRepository import com.hieuwu.groceriesstore.di.IoDispatcher import com.hieuwu.groceriesstore.domain.usecases.CreateNewOrderUseCase import kotlinx.coroutines.CoroutineDispatcher diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImpl.kt index f013a6c5..2a0f8e02 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCategoriesListUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.CategoryRepository +import com.hieuwu.groceriesstore.repository.CategoryRepository import com.hieuwu.groceriesstore.domain.usecases.GetCategoriesListUseCase import javax.inject.Inject diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImpl.kt index 24f69b79..5ea7f69e 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetCurrentCartUseCaseImpl.kt @@ -1,8 +1,8 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.OrderRepository +import com.hieuwu.groceriesstore.repository.OrderRepository import com.hieuwu.groceriesstore.domain.usecases.GetCurrentCartUseCase -import com.hieuwu.groceriesstore.utilities.OrderStatus +import com.hieuwu.groceriesstore.models.OrderStatus import javax.inject.Inject class GetCurrentCartUseCaseImpl @Inject constructor( diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetOrderListUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetOrderListUseCaseImpl.kt index f1727fb9..f6e32220 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetOrderListUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetOrderListUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.OrderRepository +import com.hieuwu.groceriesstore.repository.OrderRepository import com.hieuwu.groceriesstore.di.IoDispatcher import com.hieuwu.groceriesstore.domain.usecases.GetOrderListUseCase import kotlinx.coroutines.CoroutineDispatcher diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImpl.kt index 11a177e9..05cb6a77 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductDetailUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.ProductRepository +import com.hieuwu.groceriesstore.repository.ProductRepository import com.hieuwu.groceriesstore.domain.usecases.GetProductDetailUseCase import javax.inject.Inject diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImpl.kt index 70be6317..1c61d623 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsByCategoryUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.ProductRepository +import com.hieuwu.groceriesstore.repository.ProductRepository import com.hieuwu.groceriesstore.domain.usecases.GetProductsByCategoryUseCase import javax.inject.Inject diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImpl.kt index 618b887b..31a42b5f 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProductsListUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.ProductRepository +import com.hieuwu.groceriesstore.repository.ProductRepository import com.hieuwu.groceriesstore.domain.usecases.GetProductsListUseCase import javax.inject.Inject diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImpl.kt index 50026b9e..25c3e2c8 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/GetProfileUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.UserRepository +import com.hieuwu.groceriesstore.repository.UserRepository import com.hieuwu.groceriesstore.domain.usecases.GetProfileUseCase import javax.inject.Inject diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RefreshAppDataUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RefreshAppDataUseCaseImpl.kt index 2e933f90..5f4f1121 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RefreshAppDataUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RefreshAppDataUseCaseImpl.kt @@ -1,8 +1,8 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.CategoryRepository -import com.hieuwu.groceriesstore.domain.repository.ProductRepository -import com.hieuwu.groceriesstore.domain.repository.RecipeRepository +import com.hieuwu.groceriesstore.repository.CategoryRepository +import com.hieuwu.groceriesstore.repository.ProductRepository +import com.hieuwu.groceriesstore.repository.RecipeRepository import com.hieuwu.groceriesstore.di.IoDispatcher import com.hieuwu.groceriesstore.domain.usecases.RefreshAppDataUseCase import kotlinx.coroutines.CoroutineDispatcher diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RemoveMealFromPlanUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RemoveMealFromPlanUseCaseImpl.kt index 87d8750d..e231d7b1 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RemoveMealFromPlanUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RemoveMealFromPlanUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.MealPlanRepository +import com.hieuwu.groceriesstore.repository.MealPlanRepository import com.hieuwu.groceriesstore.di.IoDispatcher import com.hieuwu.groceriesstore.domain.usecases.RemoveMealFromPlanUseCase import kotlinx.coroutines.CoroutineDispatcher diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RetrieveMealByTypeUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RetrieveMealByTypeUseCaseImpl.kt index 6b5bc12e..63d2b14b 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RetrieveMealByTypeUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/RetrieveMealByTypeUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.MealPlanRepository +import com.hieuwu.groceriesstore.repository.MealPlanRepository import com.hieuwu.groceriesstore.di.IoDispatcher import com.hieuwu.groceriesstore.domain.usecases.RetrieveMealByTypeUseCase import kotlinx.coroutines.CoroutineDispatcher diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImpl.kt index ddbcf0ff..cabfa6ca 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SearchProductUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.ProductRepository +import com.hieuwu.groceriesstore.repository.ProductRepository import com.hieuwu.groceriesstore.di.IoDispatcher import com.hieuwu.groceriesstore.domain.usecases.SearchProductUseCase import kotlinx.coroutines.CoroutineDispatcher diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignInUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignInUseCaseImpl.kt index c74364ad..527dd27a 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignInUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignInUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.UserRepository +import com.hieuwu.groceriesstore.repository.UserRepository import com.hieuwu.groceriesstore.di.IoDispatcher import com.hieuwu.groceriesstore.domain.usecases.SignInUseCase import kotlinx.coroutines.CoroutineDispatcher diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignOutUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignOutUseCaseImpl.kt index a918feb6..9adcb429 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignOutUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SignOutUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.UserRepository +import com.hieuwu.groceriesstore.repository.UserRepository import com.hieuwu.groceriesstore.di.IoDispatcher import com.hieuwu.groceriesstore.domain.usecases.SignOutUseCase import kotlinx.coroutines.CoroutineDispatcher diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImpl.kt index a7e7ede8..6ea0a3d2 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/SubmitOrderUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.OrderRepository +import com.hieuwu.groceriesstore.repository.OrderRepository import com.hieuwu.groceriesstore.di.IoDispatcher import com.hieuwu.groceriesstore.domain.usecases.SubmitOrderUseCase import kotlinx.coroutines.CoroutineDispatcher diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImpl.kt index 75fee144..9d03de3e 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateCartItemUseCaseImpl.kt @@ -1,12 +1,12 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.OrderRepository -import com.hieuwu.groceriesstore.domain.repository.ProductRepository +import com.hieuwu.groceriesstore.repository.OrderRepository +import com.hieuwu.groceriesstore.repository.ProductRepository import com.hieuwu.groceriesstore.di.IoDispatcher import com.hieuwu.groceriesstore.models.LineItemModel import com.hieuwu.groceriesstore.models.OrderModel import com.hieuwu.groceriesstore.domain.usecases.UpdateCartItemUseCase -import com.hieuwu.groceriesstore.utilities.OrderStatus +import com.hieuwu.groceriesstore.models.OrderStatus import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.withContext diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateProfileUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateProfileUseCaseImpl.kt index 7c5ee198..8db54a74 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateProfileUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UpdateProfileUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.UserRepository +import com.hieuwu.groceriesstore.repository.UserRepository import com.hieuwu.groceriesstore.domain.usecases.UpdateProfileUseCase import javax.inject.Inject diff --git a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UserSettingsUseCaseImpl.kt b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UserSettingsUseCaseImpl.kt index e5ac2b2d..0bd3a0ca 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UserSettingsUseCaseImpl.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/domain/usecases/impl/UserSettingsUseCaseImpl.kt @@ -1,6 +1,6 @@ package com.hieuwu.groceriesstore.domain.usecases.impl -import com.hieuwu.groceriesstore.domain.repository.UserRepository +import com.hieuwu.groceriesstore.repository.UserRepository import com.hieuwu.groceriesstore.di.IoDispatcher import com.hieuwu.groceriesstore.domain.usecases.UserSettingsUseCase import kotlinx.coroutines.CoroutineDispatcher diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/authentication/signup/SignUpViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/authentication/signup/SignUpViewModel.kt index 1b8637aa..b82a19f6 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/authentication/signup/SignUpViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/authentication/signup/SignUpViewModel.kt @@ -2,7 +2,7 @@ package com.hieuwu.groceriesstore.presentation.authentication.signup import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hieuwu.groceriesstore.domain.repository.UserRepository +import com.hieuwu.groceriesstore.repository.UserRepository import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreViewModel.kt index db112ad3..bf68f321 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/explore/ExploreViewModel.kt @@ -13,7 +13,7 @@ import com.hieuwu.groceriesstore.domain.usecases.GetCategoriesListUseCase import com.hieuwu.groceriesstore.domain.usecases.GetCurrentCartUseCase import com.hieuwu.groceriesstore.domain.usecases.SearchProductUseCase import com.hieuwu.groceriesstore.models.LineItemModel -import com.hieuwu.groceriesstore.utilities.OrderStatus +import com.hieuwu.groceriesstore.models.OrderStatus import dagger.hilt.android.lifecycle.HiltViewModel import java.util.* import kotlinx.coroutines.flow.Flow diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/FavouriteViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/FavouriteViewModel.kt index e1aa8f44..4ea2b917 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/FavouriteViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/favourite/FavouriteViewModel.kt @@ -5,7 +5,7 @@ import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.asLiveData import androidx.lifecycle.viewModelScope -import com.hieuwu.groceriesstore.domain.repository.RecipeRepository +import com.hieuwu.groceriesstore.repository.RecipeRepository import com.hieuwu.groceriesstore.models.RecipeModel import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.SharingStarted diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productdetail/ProductDetailViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productdetail/ProductDetailViewModel.kt index 9d939202..93c86cee 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productdetail/ProductDetailViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productdetail/ProductDetailViewModel.kt @@ -3,11 +3,10 @@ package com.hieuwu.groceriesstore.presentation.productdetail import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hieuwu.groceriesstore.data.database.entities.Order -import com.hieuwu.groceriesstore.domain.repository.OrderRepository +import com.hieuwu.groceriesstore.repository.OrderRepository import com.hieuwu.groceriesstore.models.OrderModel import com.hieuwu.groceriesstore.domain.usecases.GetProductDetailUseCase -import com.hieuwu.groceriesstore.utilities.OrderStatus +import com.hieuwu.groceriesstore.models.OrderStatus import dagger.hilt.android.lifecycle.HiltViewModel import java.util.* import kotlinx.coroutines.flow.MutableStateFlow diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewModel.kt index 3976ccd4..a52613a2 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/productlist/ProductListViewModel.kt @@ -10,7 +10,7 @@ import com.hieuwu.groceriesstore.domain.usecases.CreateNewOrderUseCase import com.hieuwu.groceriesstore.domain.usecases.GetCurrentCartUseCase import com.hieuwu.groceriesstore.domain.usecases.GetProductsByCategoryUseCase import com.hieuwu.groceriesstore.domain.usecases.GetProductsListUseCase -import com.hieuwu.groceriesstore.utilities.OrderStatus +import com.hieuwu.groceriesstore.models.OrderStatus import dagger.hilt.android.lifecycle.HiltViewModel import java.util.UUID import kotlinx.collections.immutable.toImmutableList diff --git a/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/ShopViewModel.kt b/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/ShopViewModel.kt index 1794bb78..35e6a7de 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/ShopViewModel.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/presentation/shop/ShopViewModel.kt @@ -10,7 +10,7 @@ import com.hieuwu.groceriesstore.domain.usecases.AddToCartUseCase import com.hieuwu.groceriesstore.domain.usecases.CreateNewOrderUseCase import com.hieuwu.groceriesstore.domain.usecases.GetCurrentCartUseCase import com.hieuwu.groceriesstore.domain.usecases.GetProductsListUseCase -import com.hieuwu.groceriesstore.utilities.OrderStatus +import com.hieuwu.groceriesstore.models.OrderStatus import dagger.hilt.android.lifecycle.HiltViewModel import java.util.* import kotlinx.coroutines.flow.Flow diff --git a/app/src/main/java/com/hieuwu/groceriesstore/utilities/Utilities.kt b/app/src/main/java/com/hieuwu/groceriesstore/utilities/Utilities.kt index 780c7e03..a06e44a2 100644 --- a/app/src/main/java/com/hieuwu/groceriesstore/utilities/Utilities.kt +++ b/app/src/main/java/com/hieuwu/groceriesstore/utilities/Utilities.kt @@ -1,7 +1,5 @@ package com.hieuwu.groceriesstore.utilities -enum class OrderStatus(val value: String) { IN_CART("cart"), COMPLETED("completed") } - const val PRODUCT_TABLE = "product" const val CATEGORY_TABLE = "category" const val USER_TABLE = "user" From 47526082bfd1695cae86d6ec53b74f274f5e6a30 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Sun, 4 Aug 2024 21:26:32 +0700 Subject: [PATCH 35/38] Update idea --- .idea/gradle.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 0b0534c6..a0d9faaf 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -10,6 +10,7 @@