This repository has been archived by the owner on Feb 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtypeDefs.gql
81 lines (72 loc) · 1.47 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
type User {
_id: ID
username: String! @unique
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
userId: User!
messages: [Message]
}
type LikesFaves {
likes: Int
favorites: [Post]
}
type Message {
_id: ID
messageBody: String!
messageDate: String
messageUser: User!
}
type PostsPage {
posts: [Post]
hasMore: Boolean
}
type Query {
getCurrentUser: User
getPosts: [Post]
getPost(postId: ID!): Post!
getUserPosts(userId: ID!): [Post]
infiniteScrollPosts(pageNum: Int!, pageSize: Int!): PostsPage
searchPosts(searchTerm:String): [Post]
}
type Token {
token: String!
}
type LoggedInUser {
token: String!
user: User!
}
type Mutation {
addPost(
title: String!
imageUrl: String!
categories: [String]!
description: String!
userId: ID!
): Post!
updateUserPost(
postId: ID!
userId: ID!
title: String!
imageUrl: String!
categories: [String]!
description: String!
): Post!
deleteUserPost(postId: ID!): Post!
addPostMessage(messageBody: String!, userId: ID!, postId: ID!): Message!
likePost(postId: ID!, username: String!): LikesFaves
unlikePost(postId: ID!, username: String!): LikesFaves
registerUser(username: String!, email: String!, password: String!): Token!
loginUser(email: String!, password: String!): LoggedInUser!
}