- Users
- id
- name
- address
- phone_number
- sex
- timestamps
- Posts
- id
- user_id
- title
- body
- timestamps
- Comments
- id
- user_id
- post_id
- body
- timestamps
Update Database information in db.py
pip install -r requirements.txt
orator migrate -c db.py
uvicorn main:app --reload
mutation createUser {
createUser(userDetails: {
name: "Care",
address: "Test Address",
phoneNumber: "1234",
sex: "male"
})
{
id
name
posts {
body
comments {
body
}
}
}
}
mutation createPost {
createPost(postDetails: {
userId: 1,
title: "My first Post",
body: "This is a Post"
})
{
id
}
}
mutation createComment {
createComment(commentDetails: {
userId: 1,
postId: 1,
body: "First Comment"
})
{
id
body
}
}
query getAllUsers {
listUsers {
id
name
posts {
title
}
}
}
query getUser {
getSingleUser(userId: 1) {
name
posts {
title
comments {
body
}
}
comments {
body
}
}
}