-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.js
59 lines (51 loc) · 984 Bytes
/
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
const { gql } = require('apollo-server')
const typeDefs = gql`
type User {
username: String!
favouriteGenre: String!
id: ID!
}
type Token {
value: String!
}
type Author {
name: String!
id: ID!
born: Int
bookCount: Int!
}
type Book {
title: String!
published: Int!
author: Author!
id: ID!
genres: [String!]!
}
type Query {
bookCount: Int!
authorCount: Int!
allBooks(author: String, genre: String): [Book!]!
allAuthors: [Author!]!
me: User
}
type Mutation {
addBook(
title: String!
author: String!
born: Int
published: Int!
genres: [String!]!
): Book
editAuthor(name: String!, setBornTo: Int!): Author
createUser(
username: String!
password: String!
favouriteGenre: String!
): User
login(username: String!, password: String!): Token
}
type Subscription {
bookAdded: Book!
}
`
module.exports = typeDefs