Я попытался использовать пример схемы в api doc ("https://aws-amplify.github.io/docs/cli-toolchain/graphql?sdk=js "), как показано ниже, о подключениях" многие ко многим ".
type Post @model {
id: ID!
title: String!
editors: [PostEditor] @connection(keyName: "byPost", fields: ["id"])
}
# Create a join model and disable queries as you don't need them
# and can query through Post.editors and User.posts
type PostEditor
@model(queries: null)
@key(name: "byPost", fields: ["postID", "editorID"])
@key(name: "byEditor", fields: ["editorID", "postID"]) {
id: ID!
postID: ID!
editorID: ID!
post: Post! @connection(fields: ["postID"])
editor: User! @connection(fields: ["editorID"])
}
type User @model {
id: ID!
username: String!
posts: [PostEditor] @connection(keyName: "byEditor", fields: ["id"])
}
Я создал все элементы, а затем попытался удалить их, но мне это не удалось, особенно в PostEditor.
Есть мутация для удаления PostEditor, поэтому я назвал ее, как показано ниже
API.graphql (graphqlOperation ((deletePostEditor, {input: {id},})))
Это не срабатывает с сообщением об ошибке ниже.
Ошибка: недопустимый узел AST: {"input": "b2f7064c-af32-49cd-8c87 - *******"}
Я думаю, что предоставил правильный идентификатор. Я проверил это по запросу.
deletePostEditor
- person Alex   schedule 29.12.2019mutation DeletePostEditor( $input: DeletePostEditorInput! $condition: ModelPostEditorConditionInput ) { deletePostEditor(input: $input, condition: $condition) { id postID editorID post { id title editors { nextToken } labels { nextToken } } editor { id username posts { nextToken } } } }
; - person MinLoveSu   schedule 02.01.2020