Created
October 8, 2021 02:06
-
-
Save manavm1990/dafb599dbcf07fc75fc2b051d50221d9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { gql } = require('apollo-server'); | |
module.exports = gql` | |
type Post { | |
_id: ID! | |
body: String! | |
createdAt: String! | |
username: String! | |
comments: [Comment] | |
commentCount: Int! | |
goodBoys: [GoodBoy] | |
goodBoyCount: Int! | |
catKnips: [CatKnip] | |
catKnipCount: Int! | |
} | |
type Comment { | |
commentId: ID! | |
createdAt: String! | |
username: String! | |
body: String! | |
} | |
type Like{ | |
id: ID! | |
createdAt: String! | |
# Optional or not? 🤷🏾♂️ | |
createdBy: User, | |
# This can be 'boy' or 'knip', etc. and is more extendible for future | |
# There is also a way to use an Enum type | |
type: String! | |
} | |
type GoodBoy { | |
gbId: ID! | |
createdAt: String! | |
username: String! | |
} | |
type CatKnip { | |
ckId: ID! | |
createdAt: String! | |
username: String! | |
} | |
type User { | |
userId: ID! | |
email: String! | |
token: String! | |
username: String! | |
createdAt: String! | |
} | |
input RegisterInput { | |
username: String! | |
password: String! | |
confirmPassword: String! | |
email: String! | |
} | |
type Query { | |
getPosts: [Post] | |
getPost(postId: ID!): Post | |
} | |
type Mutation { | |
register(registerInput: RegisterInput): User! | |
login(username: String!, password: String!): User! | |
createPost(body: String!): Post! | |
deletePost(postId: ID!): String! | |
createComment(postId: String!, body: String!): Post! | |
deleteComment(postId: ID!, commentId: ID!): Post! | |
goodBoyPost(postId: ID!): Post! | |
likePost(postId: ID!): Post! | |
} | |
type Subscription { | |
newPost: Post! | |
} | |
`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment