소스 검색

Define queries

- productTags(first: Int!): StringConnection!
- productTypes(first: Int!): StringConnection!
- productRecommendations(productId: ID!): [Product!]
Alexey Kim 2 년 전
부모
커밋
2faa6c1ec7
2개의 변경된 파일38개의 추가작업 그리고 0개의 파일을 삭제
  1. 12 0
      graphql/query_product.go
  2. 26 0
      graphql/schema.graphql

+ 12 - 0
graphql/query_product.go

@@ -272,3 +272,15 @@ func (r *productVariantResolver) Title(ctx context.Context, variant *generated.P
 
 	return strings.Join(s, " / "), nil
 }
+
+func (r *queryResolver) ProductTags(ctx context.Context, first int) (*generated.StringConnection, error) {
+	panic("not implemented")
+}
+
+func (r *queryResolver) ProductTypes(ctx context.Context, first int) (*generated.StringConnection, error) {
+	panic("not implemented")
+}
+
+func (r *queryResolver) ProductRecommendations(ctx context.Context, productID string) ([]*generated.Product, error) {
+	panic("not implemented")
+}

+ 26 - 0
graphql/schema.graphql

@@ -58,6 +58,32 @@ type Query {
         reverse: Boolean = false
         sortKey: ProductSortKeys = ID
     ): ProductConnection!
+
+    # Tags added to products.
+    # Additional access scope required: unauthenticated_read_product_tags.
+    productTags(first: Int!): StringConnection!
+
+    # List of product types for the shop's products that are published to your app.
+    productTypes(first: Int!): StringConnection!
+
+    # Find recommended products related to a given `product_id`.
+    productRecommendations(productId: ID!): [Product!]
+}
+
+type StringConnection {
+    # A list of edges.
+    edges: [StringEdge!]!
+
+    # Information to aid in pagination.
+    pageInfo: PageInfo!
+}
+
+type StringEdge {
+    # A cursor for use in pagination.
+    cursor: String!
+
+    # The item at the end of StringEdge.
+    node: String!
 }
 
 # An auto-generated type for paginating through multiple Collections.