-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypedefs.js
49 lines (45 loc) · 817 Bytes
/
typedefs.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
const gql = require('graphql-tag')
const typeDefs = gql`
# types
type Dinosaur {
id: ID!
name: String!
type: String!
createdAt: String!
updatedAt: String!
}
type User {
id:ID!
name:String
# will resolve this field, non-scalar
dinos: [Dinosaur]
}
# Inputs
input UserId {
id: ID
}
input UserInput {
name: String
}
input DinoInput {
name: String!
type: String!
}
input UserDinoInput {
userId:ID
dinoId:ID
}
# Query type
type Query {
allDinos: [Dinosaur]
aDino(input:DinoInput): Dinosaur!
aUser(input:UserId): User
}
# Mutation type
type Mutation {
makeDino(input:DinoInput): Dinosaur!
makeUser(input:UserInput): User!
makeAssociation(input:UserDinoInput): User!
}
`
module.exports = typeDefs