Add a Posts Schema just to test authentication
This commit is contained in:
30
api/src/graphql/posts.sdl.ts
Normal file
30
api/src/graphql/posts.sdl.ts
Normal file
@ -0,0 +1,30 @@
|
||||
export const schema = gql`
|
||||
type Post {
|
||||
id: Int!
|
||||
title: String!
|
||||
body: String!
|
||||
createdAt: DateTime!
|
||||
updatedAt: DateTime!
|
||||
}
|
||||
|
||||
type Query {
|
||||
posts: [Post!]! @requireAuth
|
||||
post(id: Int!): Post @requireAuth
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
`
|
||||
Reference in New Issue
Block a user