-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.js
More file actions
100 lines (88 loc) · 1.84 KB
/
schema.js
File metadata and controls
100 lines (88 loc) · 1.84 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
const { gql } = require('apollo-server');
const typeDefs = gql`
type Post {
id: ID!
title: String!
text: String!
createdAt: String!
tags: [String]
userId: ID!
imageUrl: String
}
type Tag {
id: ID!
tag: String
weight: Int
}
type Comment {
id: ID!
postId: ID!
text: String!
createdAt: String!
user: String!
}
type User {
name: String!
email: String!
password: String!
userId: ID!
}
type BlogIFollow {
url: String
}
type File {
filename: String!
mimetype: String!
path: String!
}
type Query {
getPosts: [Post]
getPostById(id: ID!): Post
getPostComments(postId: ID!): [Comment]
getBlogsIFollow: [BlogIFollow]
files: [File!]
getPostByTags(tags: [String!]): [Post]
getPostsByDate(month: String, year: String): [Post]
}
type Mutation {
createPost(
title: String!
text: String!
tags: [String]
isTesting: Boolean
file: Upload
): Post
createComment(
postId: ID!
text: String!
user: String!
isTesting: Boolean
): Comment
updatePost(
id: ID!
title: String
text: String
tags: [String]
isTesting: Boolean
file: Upload
): Post
deletePostById(id: ID!, isTesting: Boolean): Post
deleteCommentById(id: ID!, isTesting: Boolean): Comment
updateComment(id: ID!, text: String!, isTesting: Boolean): Comment
uploadFile(file: Upload!, isTesting: Boolean): File!
logIn(email: String!, password: String!): User
}
type Subscription {
comment(postId: ID!): CommentSubscriptionPayload!
post: PostSubscriptionPayload!
}
type PostSubscriptionPayload {
mutation: String!
data: Post!
}
type CommentSubscriptionPayload {
mutation: String!
data: Comment!
}
`;
module.exports = typeDefs;