Getting started Community Training Tutorials Documentation APIs, AI & Tools
type Post {
id: ID!
user: User
title: String
body: String
comments: [Comment]
}
type Comment {
id: ID!
user: User
post: Post
body: String
replies: [Comment]
}
type User {
id: ID!
name: String
username: String
email: String
phone: String
website: String
address: Address
}
type Address {
id: ID!
street: String
city: String
zipcode: String
latitude: Float
longitude: Float
}
input AddressInput {
street: String
city: String
zipcode: String
latitude: Float
longitude: Float
}
input UserInput {
name: String
username: String
email: String
phone: String
website: String
address: AddressInput
}
type Query {
# Looks for a user by ID
getUser(id: ID!): User
# Looks for a post by ID
getPost(id: ID!): Post
# Returns the list of all users
allUsers: [User]
# Returns the list of all posts
allPosts: [Post]
}
type Mutation {
# Creates a new user
createUser(user: UserInput!): User!
# Creates a new post
createPost(userId: ID!, title: String!, body: String!): Post!
# Adds a comment to a post
postComment(userId: ID!, postId: ID!, body: String!): Comment!
# Adds a reply to a comment
replyToComment(commentId: ID!, userId: ID!, body: String!): Comment!
}



