-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.graphql
executable file
·111 lines (106 loc) · 2.25 KB
/
schema.graphql
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# Define the model Battlestar
type Battlestar {
# the id of the Battlestar
id: ID! # the primary partition key in DynamoDB
# the name of the Battlestar
name: String!
}
type Result {
teamName: String
round1Heat: Int
round2Heat: Int
round3Heat: Int
round1Result: Int
seed: Int
round2Seed: Int
round3Seed: Int
round2Result: Int
round3Result: Int
finalResult: Int
bib: Int
firstName: String
gender: String
lastName: String
fullName: String
uuid: String
}
type Race {
id: ID!
name: String!
userId: String!
wsName: String
createdAt: String
updatedAt: String
results: [Result]
}
# Define the queries
type Query {
# list all Battlestars
listBattlestars: [Battlestar]
listRaces: [Race]
getRace(id: ID): Race
getRacesByUserId(userId: String!): [Race]
}
# Define the input to create a Battlestar
input PutBattlestarInput {
# the name of the Battlestar to create
name: String!
}
input ResultInput {
teamName: String
round1Heat: Int
round2Heat: Int
round3Heat: Int
round1Result: Int
seed: Int
round2Seed: Int
round3Seed: Int
round2Result: Int
round3Result: Int
finalResult: Int
bib: Int
firstName: String
gender: String
lastName: String
fullName: String
uuid: String
}
input CreateRaceInput {
# the name of the race to create
name: String!
# the id of the user creating the race
userId: String!
# the associated organization
organization: String
# the array of results for each racer
results: [ResultInput]
}
input UpdateRaceInput {
id: String!
name: String!
results: [ResultInput]
}
# Define the mutations
type Mutation {
# Create a Battlestar
putBattlestar(input: PutBattlestarInput): Battlestar
createRace(input: CreateRaceInput): Race
deleteRace(id: ID!): Race
updateRace(input: UpdateRaceInput): Race
}
# subscriptions will not work locally
# make sure to change the React and Insomnia environment
type Subscription {
addBattleStar: Battlestar @aws_subscribe(mutations: ["putBattlestar"])
addRace: Race @aws_subscribe(mutations: ["createRace"])
modifyRace: Race @aws_subscribe(mutations: ["updateRace"])
}
# Define the schema
schema {
# all the queries
query: Query
# all the mutations
mutation: Mutation
# all the subscriptions
subscription: Subscription
}