Skip to content

Instantly share code, notes, and snippets.

@uno-de-piera
Created August 8, 2019 19:58
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 uno-de-piera/490c1e1db34c76ba68a43bcc6580b9b6 to your computer and use it in GitHub Desktop.
Save uno-de-piera/490c1e1db34c76ba68a43bcc6580b9b6 to your computer and use it in GitHub Desktop.
enum PostStatus {
PENDING #Pendiente
PUBLISHED #Publicado
}
type Post @model @auth(
rules: [
{allow: owner, ownerField: "owner", operations: [create, update, delete, read]}, #puede realizar esas operaciones
]
) {
id: ID! #id autogeneradas!
owner: String #autor
title: String! #string!
body: String! #string!
status: PostStatus! #enums!
deleted: Boolean #booleanos!
comments: [Comment] @connection(name: "PostComments") #un Post puede tener muchos comentarios
createdAt: AWSDateTime! #fechas!
updatedAt: AWSDateTime! #fechas!
}
type Comment @model @auth(
rules: [
{allow: owner, ownerField: "owner"},
]
) {
id: ID!
post: Post @connection(name: "PostComments")
postId: ID! #útil para hacer consultas en un futuro
comment: String!
createdAt: AWSDateTime!
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment