Skip to content

Instantly share code, notes, and snippets.

@dabit3
Created October 22, 2020 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dabit3/31edec32294575594b054bbe6df00c4b to your computer and use it in GitHub Desktop.
Save dabit3/31edec32294575594b054bbe6df00c4b to your computer and use it in GitHub Desktop.
Next.js + Amplify - schema.graphql
type Post @model
@auth(rules: [
{ allow: owner, ownerField: "username" },
{ allow: public, operations: [read] }
]) {
id: ID!
name: String!
content: String
comments: [Comment] @connection(keyName: "commentsByPostId", fields: ["id"])
username: String
createdAt: AWSDateTime
}
type Comment @model
@key(name: "commentsByPostId", fields: ["postId"], queryField: "commentsByPostId")
@auth(rules: [
{ allow: owner, ownerField: "username" },
{ allow: public, operations: [read] }
]) {
id: ID!
postId: ID!
message: String!
username: String
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment