Database design 如何在GraphQL中为具有属于另一个节点的项目数组的节点创建变异&;你';您已经有要包括的项目的ID了吗?

Database design 如何在GraphQL中为具有属于另一个节点的项目数组的节点创建变异&;你';您已经有要包括的项目的ID了吗?,database-design,graphql,aws-amplify,aws-appsync,Database Design,Graphql,Aws Amplify,Aws Appsync,我是GraphQL的新手,我正在用Amplify/AppSync构建一个Angular 11应用程序 在我的GraphQL模式中有一个名为Announcement的模型,它与另一个模型Member有多对多关系。我们的想法是,我们正在创建一个公告,其中包含关于谁应该接收此公告的信息 这是模式:- type Announcement @model @auth( rules: [ { allow: groups, groups: ["SUPER_ADMIN&quo

我是GraphQL的新手,我正在用Amplify/AppSync构建一个Angular 11应用程序

在我的GraphQL模式中有一个名为Announcement的模型,它与另一个模型Member有多对多关系。我们的想法是,我们正在创建一个公告,其中包含关于谁应该接收此公告的信息

这是模式:-

type Announcement
  @model
  @auth(
    rules: [
      { allow: groups, groups: ["SUPER_ADMIN"] }
      {
        allow: owner
        ownerField: "author"
        operations: [create, update, delete]
      }
    ]
  ) {
  id: ID!

  "Title of the announcement"
  title: String!

  "The person who is making the announcement"
  author: Member! 

  "Message of the announcement"
  message: String!

  "List of members that the announcement should be delivered to"
  recipients: [Member]

  "List of groups that this announcement should be delivered to"
  groups: [Group]

  "List of members that this announcement has been seen by"
  seenBy: [Member] 

  "Search Field for searching the entire table for a string"
  searchField: String
}


"""
Groups of students. Groups can be of these types - class, team or coordinators.
"""
type Group
  @model
  @auth(
    rules: [
      { allow: groups, groups: ["SUPER_ADMIN"] }
    ]
  ) {
  id: ID!

  "Name of the group"
  name: String!

  "List of members in this group"
  members: [Member]

  "Search Field for searching the entire table for a string"
  searchField: String
}

type Member
  @model(subscriptions: null)
  @auth(
    rules: [
      { allow: groups, groups: ["SUPER_ADMIN"], operations: [create, delete] }
      { allow: owner, ownerField: "id", operations: [update] }
    ]
  ) {
  id: ID!

  "Name of the person"
  name: String!

  "Email ID of the person"
  email: String!
    @auth(
      rules: [{ allow: owner, ownerField: "id", operations: [read, update] }]
    )

  "Type of the user, i.e. the Cognito User pool group"
  type: String!

  "Title of the person"
  title: String

  "Bio of the person"
  bio: String

}
在此场景中,当我创建公告时,自动生成的CreateAnnouncementVariation希望我的输入如下所示:-

    export type CreateAnnouncementMutation ={
  __typename:"Announcement";
      id:string;
      title:string;
      author:{
    __typename:"Member";
        id:string;
        name:string;
        title?:string | null;
        bio?:string | null;
        searchField?:string | null;
          createdAt:string;
          updatedAt:string;
  };
        
     message:string;
      recipients?:Array<{
    {
      __typename:"Member";
        id:string;
        name:string;
        title?:string | null;
        bio?:string | null;
        searchField?:string | null;
          createdAt:string;
          updatedAt:string;
    }| null> | null;
      seenBy?:Array<{
    {
      __typename:"Member";
        id:string;
        name:string;
        title?:string | null;
        bio?:string | null;
        searchField?:string | null;
          createdAt:string;
          updatedAt:string;
    }| null> | null;
};
CreateAnnouncementMutation ={
  title:"title of the announcement",
  author:"memberId",
  message:"Announcement content",
  recipients:["memberId1", "memberId2", "memberId3"],
  seenBy:[]
}
我怎样才能让它工作