-
-
Save uno-de-piera/490c1e1db34c76ba68a43bcc6580b9b6 to your computer and use it in GitHub Desktop.
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
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