-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.js
More file actions
49 lines (43 loc) · 959 Bytes
/
schema.js
File metadata and controls
49 lines (43 loc) · 959 Bytes
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
export const typeDefs = `#graphql
type Game {
id: ID!, # ! means this field is required
title: String!,
platform: [String!]!
reviews: [Review!], # relationship
}
type Review {
id: ID!,
rating: Int!,
content: String!,
game: Game!, # relationship
author: Author!, # relationship
}
type Author {
id: ID!,
name: String!,
verified: Boolean!,
reviews: [Review!], # relationship
}
# define the entry point of every GraphQL query
type Query {
reviews: [Review],
review(id: ID!): Review,
games: [Game],
game(id: ID!): Game,
authors: [Author],
author(id: ID!): Author,
}
type Mutation {
addGame(game: AddGameInput!): Game,
deleteGame(id: ID!): [Game],
updateGame(id: ID!, edits: EditGameInput!): Game,
}
input AddGameInput {
title: String!,
platform: [String!]!,
}
input EditGameInput {
title: String,
platform: [String!],
}
`;