首页 > 解决方案 > 是否可以与 Appsync GrapQL 建立内部连接?

问题描述

对于某些情况,我有以下代码:

 type Product
  @model
  @key(name: "byProductCategory", fields: ["productCategoryID", "name"])
  @auth(
    rules: [
      { allow: groups, groups: ["Driver", "Restaurant"], operations: [read] }
      {
        allow: groups
        groups: ["SuperAdmin"]
        operations: [read, create, update, delete]
      }
    ]
  ) {
  id: ID!
  productCategoryID: ID!
  name: String!
  brand: String!
  mainImage: Image @connection
  images: [Image] @connection(keyName: "byProduct", fields: ["id"])
  description: String
  category: ProductCategory @connection(fields: ["productCategoryID"])
  alternative: [Product]
  byproduct: [Byproduct]
}

我想显示产品类型的替代产品列表,但不允许。我尝试制作一个@connection,但在某些情况下,GrapQL 编译器不允许我在其他情况下看到它,但无法通过 Mutation 插入新的替代方案。还尝试遵循下一个示例。可以查询但不能改变它 https://www.apollographql.com/blog/explaining-graphql-connections-c48b7c3d6976/

标签: graphqlaws-amplifyaws-appsyncamazon-dynamodb

解决方案


推荐阅读