Migration/data layer graph ql#31
Merged
Merged
Conversation
…e related imports
…nt for GraphQL queries
# Conflicts: # data/src/commonMain/kotlin/com/troves/data/source/remote/RemoteDatasource.kt # data/src/commonMain/kotlin/com/troves/data/source/remote/RemoteDatasourceImpl.kt # data/src/commonMain/kotlin/com/troves/data/source/remote/service/ktor/dto/CartItemDto.kt
WAHID-QANDIL
approved these changes
Jul 2, 2026
There was a problem hiding this comment.
Pull request overview
This PR migrates the data layer’s Shopify API integration toward GraphQL by introducing an Apollo-backed TrovesApiService implementation, adding GraphQL operations/fragments, and reorganizing the existing Ktor REST service/DTO packages to coexist with the new GraphQL flow.
Changes:
- Added Apollo GraphQL client wiring + Gradle plugin setup, plus Shopify Admin GraphQL queries/fragments.
- Introduced
ApolloTrovesApiServiceImpland GraphQL→DTO/domain mappers/utilities while keeping the Ktor implementation available. - Refactored/relocated Ktor service + DTO packages and updated imports across the data layer.
Reviewed changes
Copilot reviewed 32 out of 35 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| shared/src/commonMain/kotlin/com/troves/App.kt | Adds DI injection + a startup prefetch in LaunchedEffect. |
| gradle/libs.versions.toml | Adds Apollo version, libraries, plugin, and bundle entries. |
| data/src/commonMain/kotlin/com/troves/data/source/remote/service/TrovesApiService.kt | Updates DTO imports to new Ktor DTO package. |
| data/src/commonMain/kotlin/com/troves/data/source/remote/service/ktor/KtorTrovesApiServiceImpl.kt | Renames/repacks Ktor service implementation under ...service.ktor. |
| data/src/commonMain/kotlin/com/troves/data/source/remote/service/ktor/HttpClientExt.kt | Moves extension utilities into the ...service.ktor package. |
| data/src/commonMain/kotlin/com/troves/data/source/remote/service/ktor/dto/WishlistDto.kt | Moves DTO package to ...service.ktor.dto. |
| data/src/commonMain/kotlin/com/troves/data/source/remote/service/ktor/dto/SingleProductResponse.kt | Moves DTO package to ...service.ktor.dto. |
| data/src/commonMain/kotlin/com/troves/data/source/remote/service/ktor/dto/ProductResponse.kt | Moves DTO package to ...service.ktor.dto. |
| data/src/commonMain/kotlin/com/troves/data/source/remote/service/ktor/dto/MarketingEvent.kt | Moves DTO package to ...service.ktor.dto. |
| data/src/commonMain/kotlin/com/troves/data/source/remote/service/ktor/dto/Collection.kt | Moves DTO package to ...service.ktor.dto. |
| data/src/commonMain/kotlin/com/troves/data/source/remote/service/ktor/dto/CartItemDto.kt | Adds a new DTO file (but currently with a mismatched package). |
| data/src/commonMain/kotlin/com/troves/data/source/remote/service/ktor/dto/Brands.kt | Moves DTO package to ...service.ktor.dto. |
| data/src/commonMain/kotlin/com/troves/data/source/remote/service/ktor/AuthPlugin.kt | Moves Auth plugin into the ...service.ktor package. |
| data/src/commonMain/kotlin/com/troves/data/source/remote/service/apollo/util/ShopifySearchQuery.kt | Adds helpers to build Shopify GraphQL search query strings. |
| data/src/commonMain/kotlin/com/troves/data/source/remote/service/apollo/util/ApolloExtensions.kt | Adds Apollo→Result helpers and ID/query utilities. |
| data/src/commonMain/kotlin/com/troves/data/source/remote/service/apollo/mapper/ProductMapper.kt | Adds GraphQL fragment → DTO/domain mapping. |
| data/src/commonMain/kotlin/com/troves/data/source/remote/service/apollo/mapper/DtoFactory.kt | Adds small DTO factory helpers used by mappers. |
| data/src/commonMain/kotlin/com/troves/data/source/remote/service/apollo/mapper/CollectionMapper.kt | Adds GraphQL collections → DTO mapping. |
| data/src/commonMain/kotlin/com/troves/data/source/remote/service/apollo/ApolloTrovesApiServiceImpl.kt | Introduces Apollo-backed TrovesApiService (some methods still TODO). |
| data/src/commonMain/kotlin/com/troves/data/source/remote/RemoteDatasourceImpl.kt | Updates imports to the moved DTO packages. |
| data/src/commonMain/kotlin/com/troves/data/source/remote/RemoteDatasource.kt | Updates imports to the moved DTO packages. |
| data/src/commonMain/kotlin/com/troves/data/repository/WishlistRepositoryImpl.kt | Updates Wishlist DTO import. |
| data/src/commonMain/kotlin/com/troves/data/repository/TrovesRepositoryImpl.kt | Updates repository logic usage; currently includes a broken import. |
| data/src/commonMain/kotlin/com/troves/data/network/ShopifyNetworkClient.kt | Updates Auth plugin import to new package. |
| data/src/commonMain/kotlin/com/troves/data/network/ApolloClient.kt | Adds an Apollo client provider for Shopify Admin GraphQL. |
| data/src/commonMain/kotlin/com/troves/data/mapper/HomeMappers.kt | Updates DTO imports to the moved Ktor DTO package. |
| data/src/commonMain/kotlin/com/troves/data/di/DataModule.kt | Wires Apollo client + Apollo service impl into DI. |
| data/src/commonMain/graphql/GetProductsBySearch.graphql | Adds GraphQL search query. |
| data/src/commonMain/graphql/GetProducts.graphql | Adds GraphQL products query (+ pagination fields). |
| data/src/commonMain/graphql/GetProductById.graphql | Adds GraphQL product-by-id query. |
| data/src/commonMain/graphql/GetCollections.graphql | Adds GraphQL collections query. |
| data/src/commonMain/graphql/Fragments.graphql | Adds shared ProductCard fragment. |
| data/build.gradle.kts | Applies Apollo plugin, adds dependencies, and configures Apollo service/introspection. |
| build.gradle.kts | Adds Apollo plugin alias at root (apply false). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import kotlinx.coroutines.IO | ||
| import kotlinx.coroutines.withContext | ||
| import kotlinx.io.IOException | ||
| import kotlin.map |
Comment on lines
+15
to
+18
| val apiService = koinInject<TrovesApiService>() | ||
| LaunchedEffect(key1 = Unit) { | ||
| apiService.getAllProducts() | ||
| } |
Comment on lines
+35
to
+37
| override suspend fun createProduct(productDto: ProductDto): Result<ProductDto> { | ||
| TODO("Not yet implemented") | ||
| } |
Comment on lines
+64
to
+66
| override suspend fun getProductImages(productId: String): Result<List<CollectionImage>> { | ||
| TODO("Not yet implemented") | ||
| } |
Comment on lines
+97
to
+99
| override suspend fun getAllEventsById(eventId: String): MarketingEventsResponse { | ||
| TODO("Not yet implemented") | ||
| } |
|
|
||
|
|
||
| introspection { | ||
| endpointUrl.set("${url}graphql.json") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.