-
Notifications
You must be signed in to change notification settings - Fork 0
/
typeDefs.gql
63 lines (56 loc) · 1.49 KB
/
typeDefs.gql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
type User {
_id: ID
username: String!
email: String!
password: String!
avatar: String
joinDate: String
favorites: [Post]
}
type Post {
_id: ID
title: String!
imageUrl: String!
categories: [String]!
description: String!
createdDate: String
likes: Int
createdBy: User!
messages: [Message]
}
type Message {
_id: ID
messageBody: String!
messageDate: String
messageUser: User!
}
type Token {
token: String!
}
type PostsPage {
posts: [Post]
hasMore: Boolean
}
# Likes for post / Favorites for users
type LikesFaves {
likes: Int
favorites: [Post]
}
type Query {
getCurrentUser: User
getPosts: [Post]
getUserPosts(userId: ID!): [Post]
getPost(postId: ID!): Post!
searchPosts(searchTerm: String): [Post]
infiniteScrollPosts(pageNum: Int!, pageSize: Int!): PostsPage
}
type Mutation {
addPost(title: String!, imageUrl: String!, categories:[String!], description: String!, creatorId: ID!): Post!
updateUserPost(postId: ID!, userId: ID!, title: String!, imageUrl: String!, categories: [String!], description: String!): Post!
deleteUserPost(postId: ID!): Post!
likePost(postId: ID!, username: String!): LikesFaves!
unlikePost(postId: ID!, username: String!): LikesFaves!
signinUser(username: String!, password: String!): Token
signupUser(username: String!, email: String!, password: String!): Token
addPostMessage(messageBody: String!, userId: ID!, postId: ID!): Message!
}