-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.js
71 lines (63 loc) · 1.13 KB
/
schema.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
const { gql } = require("apollo-server");
const typeDefs = gql`
type Category {
id: ID!
name: String!
}
type Author {
id: ID!
firstname: String!
lastname: String!
email: String!
posts: [Post]
}
type Post {
id: ID!
title: String!
article: String!
author: Author!
category: Category!
}
type Query {
categories: [Category]!
category(id: ID!): Category
authors: [Author]!
author(id: ID!): Author
posts: [Post]!
post(id: ID!): Post
}
type Mutation {
addCategory(name: String!): Category!
updateCategory(id: ID!, name: String): Category!
deleteCategory(id: ID!): Boolean!
addAuthor(
firstname: String!
lastname: String!
email: String
posts: [String]
): Author!
updateAuthor(
id: ID!
firstname: String
lastname: String
email: String
posts: [String]
): Boolean!
deleteAuthor(id: ID!): Author!
addPost(
title: String!
article: String!
author: String!
category: String!
): Post!
updatePost(
id: ID!
title: String
article: String
author: String
category: String
): Post!
deletePost(id: ID!): Boolean!
}
`;
module.exports = typeDefs;