-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.graphql
162 lines (147 loc) · 3.33 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
type User {
name: String
username: String
avatar: String
email: String!
password: String
messages: [Message!]!
incomingFriendRequests: [User!]!
outgoingFriendRequests: [User!]!
friends: [User!]!
matchInvites: [Match!]!
matches: [Match!]!
finishedMatches: [Match!]!
playerStatistics: PlayerStatistics!
missions: [Mission!]!
finishedMissions: [Mission!]!
money: Int!
items: [Item!]!
battlePass: BattlePass
}
type PlayerStatistics {
rating: Int
ratingHistory: [Int!]
wins: Int!
losses: Int!
stalemates: Int!
totalGames: Int!
winRate: Float
}
type Match {
_id: ID!
name: String
matchOwner: User!
pendingPlayers: [User!]!
players: [User!]!
inProgress: Boolean!
boardSkin: Item!
pieceSkin: Item!
matchResults: MatchResults
whitePlayer: User
blackPlayer: User
fen: Fen!
fenHistory: [Fen!]!
}
type MatchResults {
winner: User
loser: User
winnerNewRating: Int
loserNewRating: Int
}
type Item {
_id: ID!
type: ITEM_TYPE!
name: String!
description: String!
thumbnail: String
images: String
cost: Int
}
enum ITEM_TYPE {
BOARD_SKIN
PIECE_SKIN
BATTLE_PASS
}
type Shop {
items: [Item!]!
battlePass: BattlePass
}
type BattlePass {
_id: ID!
items: [Item!]!
tiers: [Int!]!
cost: Int
totalXP: Int!
currentTier: Int!
}
type Mission {
_id: ID!
name: String!
description: String!
reward: ID!
gainedXP: Int!
progress: Int!
threshold: Int!
}
type Message {
_id: ID!
date: DateTime!
message: String!
to: User!
from: User!
readBy: [User!]!
}
type GoogleLoginReponsePayload {
token: AuthorizationToken
redirectPath: String
}
type MessagePayload {
_id: ID!
date: DateTime!
message: String!
from: String!
}
scalar DateTime
scalar AuthorizationToken
scalar Fen
type Query {
selfLookup: User
userLookup(name: String, username: String, email: String): User
userSearch(query: String!): [User!]!
userTopRating(first: Int!): [User!]!
matchLookup(_id: ID!): Match
matchSearch(query: String!): [Match!]!
shop: Shop!
}
type Mutation {
createUser(email: String!, password: String!, username: String!): AuthorizationToken!
loginUser(email: String, username: String, password: String!): AuthorizationToken
googleLogin(token: ID!): GoogleLoginReponsePayload
editUser(name: String, username: String, avatar: String, email: String, password: String): User!
sendResetPasswordEmail(email: String, username: String): Boolean
requestFriend(friendUsername: String!): User
resolveRequestFriend(friendUsername: String!, choice: Boolean!): User
createMatch: Match!
editMatch(matchId: ID!, gameType: String, name: String, boardSkin: ID, pieceSkin: ID): Match
inviteFriend(matchId: ID!, friendUsername: String!): Match
resolveInviteFriend(matchId: ID!, choice: Boolean!): Match
deleteUserFromMatch(matchId: ID!, friendUsername: String): Match
deleteMatch(matchId: ID!): Boolean
startMatch(matchId: ID!): Match
makeMove(matchId: ID!, updatedFen: Fen!): Match
resolveMatch(matchId: ID!, finalFen: Fen!): Match
sendMessage(friendUsername: String!, message: String!): Message
readMessage(messageId: ID!): Message
buyItem(itemId: ID!): User
}
type Subscription {
newFriendRequest: String!
newFriend: String!
newMatchInvite: ID!
newMatchPlayer(matchId: ID!): String
deletedMatchPlayer(matchId: ID!): String
deletedMatch(matchId: ID!): ID
newMatchInProgress(matchId: ID!): Boolean
newMatchMove(matchId: ID!): Fen
newMessage: MessagePayload!
}