44 lines
639 B
GraphQL
44 lines
639 B
GraphQL
type Post {
|
|
id: ID!
|
|
title: String!
|
|
author: String!
|
|
contents: String!
|
|
comments: [Comment!]!
|
|
allowComments: Boolean!
|
|
}
|
|
|
|
type Comment {
|
|
id: ID!
|
|
post: Post!
|
|
author: String!
|
|
contents: String!
|
|
replyTo: Comment
|
|
replies: [Comment!]!
|
|
}
|
|
|
|
type Query {
|
|
allPosts: [Post!]!
|
|
}
|
|
|
|
type Mutation {
|
|
addPost(input: PostInput): AddResult!
|
|
addComment(input: CommentInput): AddResult!
|
|
}
|
|
|
|
input PostInput {
|
|
title: String!
|
|
author: String!
|
|
contents: String!
|
|
allowComments: Boolean! = true
|
|
}
|
|
|
|
input CommentInput {
|
|
parentPostId: ID
|
|
parentCommentId: ID
|
|
author: String!
|
|
contents: String!
|
|
}
|
|
|
|
type AddResult {
|
|
itemId: ID!
|
|
}
|