Files
redwood-tutorial/api/src/graphql/posts.sdl.js
A. David Thyresson f9fd46e710 Redwood v0.37 updates
2021-10-01 16:26:41 -04:00

30 lines
555 B
JavaScript

export const schema = gql`
type Post {
id: Int!
title: String!
body: String!
createdAt: DateTime!
}
type Query {
posts: [Post!]! @skipAuth
post(id: Int!): Post @skipAuth
}
input CreatePostInput {
title: String!
body: String!
}
input UpdatePostInput {
title: String
body: String
}
type Mutation {
createPost(input: CreatePostInput!): Post! @requireAuth
updatePost(id: Int!, input: UpdatePostInput!): Post! @requireAuth
deletePost(id: Int!): Post! @requireAuth(roles: ["FOO"])
}
`