-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathindex.js
74 lines (58 loc) · 2.05 KB
/
index.js
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
import {
GraphQLObjectType,
GraphQLSchema
} from 'graphql'
// Query & Mutations
import UserQuery from './user/UserQuery.js'
import UserMutation from './user/UserMutation.js'
import ArticleQuery from './article/ArticleQuery.js'
import ArticleMutation from './article/ArticleMutation.js'
import TagQuery from './tag/TagQuery.js'
import TagMutation from './tag/TagMutation.js'
import CommentQuery from './comment/CommentQuery.js'
import CommentMutation from './comment/CommentMutation.js'
import replyMutation from './reply/replyMutation.js'
import LinkQuery from './link/LinkQuery.js'
import LinkMutation from './link/LinkMutation.js'
export default new GraphQLSchema({
query: new GraphQLObjectType({
name: 'RootQueryType',
fields: {
users: UserQuery.users,
user: UserQuery.user,
article: ArticleQuery.article,
getArticleById: ArticleQuery.getArticleById,
tags: TagQuery.tags,
articleByTagId: TagQuery.articleByTagId,
articleByTagName: TagQuery.articleByTagName,
comments: CommentQuery.comments,
links: LinkQuery.links
}
}),
mutation: new GraphQLObjectType({
name: 'RootMutationType',
fields: {
login: UserMutation.login,
loginByEmail: UserMutation.loginByEmail,
register: UserMutation.register,
logout: UserMutation.logout,
setAdmin: UserMutation.setAdmin,
setPassword: UserMutation.setPassword,
removeUser: UserMutation.removeUser,
updateUser: UserMutation.updateUser,
setSubscribe: UserMutation.setSubscribe,
addArticle: ArticleMutation.addArticle,
deleteArticle: ArticleMutation.deleteArticle,
updateArticle: ArticleMutation.updateArticle,
releaseArticle: ArticleMutation.releaseArticle,
addTag: TagMutation.addTag,
updateTag: TagMutation.updateTag,
removeTag: TagMutation.removeTag,
addComment: CommentMutation.addComment,
addReply: replyMutation.addReply,
addLink: LinkMutation.addLink,
updateLink: LinkMutation.updateLink,
removeLink: LinkMutation.removeLink
}
})
})