Skip to content

Migration/data layer graph ql#31

Merged
yassenRamadan1 merged 5 commits into
developfrom
migration/data_layer_graphQL
Jul 2, 2026
Merged

Migration/data layer graph ql#31
yassenRamadan1 merged 5 commits into
developfrom
migration/data_layer_graphQL

Conversation

@yassenRamadan1

Copy link
Copy Markdown
Contributor

No description provided.

WAHID-QANDIL and others added 5 commits July 2, 2026 00:51
# 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
@yassenRamadan1 yassenRamadan1 merged commit 72ac66c into develop Jul 2, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ApolloTrovesApiServiceImpl and 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")
}
Comment thread data/build.gradle.kts


introspection {
endpointUrl.set("${url}graphql.json")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants