Reactjs prisma中嵌套类型的对应graphql标记突变

Reactjs prisma中嵌套类型的对应graphql标记突变,reactjs,apollo-client,prisma,graphql-tag,Reactjs,Apollo Client,Prisma,Graphql Tag,我想知道如何在嵌套类型中使用graphql标记应用mutation,因为在prisma中我使用create分配字段 我的datamodel.graphql type Item { id: ID! @id @unique title: String description: String price: Int laptop: Laptop @relation(link: INLINE) } type Lapt

我想知道如何在嵌套类型中使用
graphql标记
应用
mutation
,因为在prisma中我使用
create
分配字段

我的
datamodel.graphql

    type Item {
      id: ID! @id @unique
      title: String
      description: String 
      price: Int
      laptop: Laptop @relation(link: INLINE)


   }

    type Laptop {
       id: ID! @id
       brand: String

   }
    type Mutation {
      createItem(
        title: String
        description: String
        price: Int
        laptop: LaptopCreateOneInput
     ): Item!
    }
我的
schema.graphql

    type Item {
      id: ID! @id @unique
      title: String
      description: String 
      price: Int
      laptop: Laptop @relation(link: INLINE)


   }

    type Laptop {
       id: ID! @id
       brand: String

   }
    type Mutation {
      createItem(
        title: String
        description: String
        price: Int
        laptop: LaptopCreateOneInput
     ): Item!
    }
到目前为止我确实试过了,但没用

    const CREATE_ITEM_MUTATION = gql`
       mutation CREATE_ITEM_MUTATION(
         $title: String!
         $description: String!
         $price: Int!
         $laptop: LaptopCreateOneInput

      ) {
        createItem(
          title: $title
          description: $description
          price: $price
          laptop:$laptop
        ) {
           id
          }
     }
   `;
我可以像这样在graphql中应用突变

    mutation {
      createItem(
        title: "computer"
        description: "some computer"
        price: 1000
        laptop: { create: { brand: "some brand" } }
     ) {
      title
     description
     }
   }

我确实通过使用
create
word更新状态使其工作

state = {
  title: '',
  price: 0,
  laptop: {
    create: {
      brand: ''
    }
  },
  description: '',
};