-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtypeDefs.gql
More file actions
67 lines (60 loc) · 1.29 KB
/
Copy pathtypeDefs.gql
File metadata and controls
67 lines (60 loc) · 1.29 KB
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
64
65
66
67
type User {
_id: ID
username: String!
email: String!
password: String!
avatar: String
joinDate: String
favorites: [Post]
}
# for both post likes & user favorites
type LikesFavorties {
likes: Int
favorites: [Post]
}
type Post {
_id: ID
title: String!
imgUrl: 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]
hasMorePosts: Boolean
}
type Query {
getPosts: [Post]
getCurrentUser: User
getUserPosts(user_id: ID!): [Post]
getPost(post_id: ID!): Post!
searchPosts(searchTerm: String): [Post]
infiniteScrollPosts(pageNum: Int!, pageSize: Int!): PostsPage
}
type Mutation {
addPost(
title: String!
imgUrl: String!
description: String!
categories: [String]!
creatorId: ID!
): Post!
addPostMessage(messageBody: String!, post_id: ID!, user_id: ID!): Message!
likePost(post_id: ID!, username: String!): LikesFavorties!
unLikePost(post_id: ID!, username: String!): LikesFavorties!
signupUser(username: String!, email: String!, password: String!): Token
signinUser(username: String!, password: String!): Token
}