-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.graphql
107 lines (72 loc) · 1.83 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
type User {
# unique id of the user / app installation
id: String
# Define whether a User is currently allowed to vote
canVote: Boolean
# UTC Date when the user can vote again
canVoteAgainAt: Date
}
# A District is the entity that someone can vote upon
type District {
# Code/identifier, e.g. OF
id: String
# Name of the district, e.g. Offenbach
name: String
# Greater region this district belongs to, e.g. Hessen
region: Region
# The country this district belongs to
country: Country
}
# A country being represented by the App (initially only Germany)
type Country {
# 2-Letter ISO code
id: String
# Country name
name: String
}
# A region within a country (e.g. a state)
type Region {
id: String
name: String
country: Country
}
# A single ranking for one district
type DistrictRanking {
district: District
votes: Int
}
# A single ranking for one region
type DistrictRanking {
region: Region
votes: Int
}
# Root Query type to start all data queries
type Query {
# get a list of all districts
districts: [District]
# get the ranking results for districts (requires country)
districtRankings(countryID: String!): [DistrictRanking]
# get the ranking results for regions (requires country)
regionRankings(countryID: String!): [RegionRanking]
}
# Input type for voteDistrict mutation
input VoteDistrictInput {
# The voting user
userID: String!
# The country being represented by the app
countryID: String!
# The district to vote on
districtID: String!
}
# Output type for voteDistrict mutation
type VoteDistrictOutput {
# The district voted on
district: District
# The user that voted
user: User
}
# All mutations/actions that can be performed
type Mutation {
# vote against a district
mutation voteDistrict(data: VoteDistrictInput): VoteDistrictOutput
}