STEP-7 GraphQL types, Helpers

As we have successfully established a connection with backend and frontend, let's prepare and collect all configurations we created at STEP-3 transfer.

STEP-7arrow-up-right

  1. First of all, we going to modify our schema.graphqls to gain an understanding of our data structure

ScandiPWA/SocialShareGraphQl/etc/schema.graphqls
type Query {
   socialShare: socialShareType @resolver(class:"\\ScandiPWA\\SocialShareGraphQl\\Model\\Resolver\\SocialShare")
}

type socialShareType {
   socialShareConfig: socialShareConfig
   providers: [ socialShareProvider ]
}

type socialShareConfig {
   enabled: Boolean
   rounded: Boolean
   size: String
   categoryPage: Boolean
   productPage: Boolean
   homePage: Boolean
}

type socialShareProvider {
   id: String
   counter: Boolean
   additional: String
}

Ok now we know how our data structure will look like, then we going to pass data through graphql, will create a Helper which will provide socialShareConfig and providers and map all fields. 2. Create Helper folder in <MODULE ROOT> and DataProvider.php in it

3. Now we going to modify our resolver and request data from DataProvider

4. Now again using Altair GraphQL Clientarrow-up-right we going to check if we did everything right

Last updated