Last active
November 25, 2020 22:45
-
-
Save Nxtra/13f7f7cadee48d95bdb1c2b6007135d6 to your computer and use it in GitHub Desktop.
Amplify schema with relations and custom mutation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Blog @model { | |
id: ID! | |
name: String! | |
posts: [Post] @connection(keyName: "byBlog", fields: ["id"]) | |
} | |
type Post @model @key(name: "byBlog", fields: ["blogID"]) { | |
id: ID! | |
title: String! | |
blogID: ID! | |
blog: Blog @connection(fields: ["blogID"]) | |
comments: [Comment] @connection(keyName: "byPost", fields: ["id"]) | |
} | |
type Comment @model @key(name: "byPost", fields: ["postID", "content"]) { | |
id: ID! | |
postID: ID! | |
post: Post @connection(fields: ["postID"]) | |
content: String! | |
} | |
type Mutation { | |
deletePostAndComments(postId: ID!): DeletePostAndCommentsResponse | |
@function(name: "editPostAndComments-${env}") | |
} | |
type DeletePostAndCommentsResponse { | |
id: ID! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment