@opprs/db-prisma 2.2.1-canary.ccb79aa → 2.2.1-canary.cd8b178
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +963 -156
- package/dist/index.d.cts +795 -105
- package/dist/index.d.ts +795 -105
- package/dist/index.js +870 -139
- package/package.json +2 -2
- package/prisma/migrations/20260104092800_add_location_model_and_tournament_fields/migration.sql +45 -0
- package/prisma/migrations/20260104210034_add_policy_acceptance_fields/migration.sql +19 -0
- package/prisma/migrations/20260104231435_split_entries_standings/migration.sql +137 -0
- package/prisma/migrations/20260105000000_add_oppr_ranking_models/migration.sql +108 -0
- package/prisma/schema.prisma +225 -37
- package/prisma/seed.ts +107 -35
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _prisma_client_runtime_library from '@prisma/client/runtime/library';
|
|
2
2
|
import * as _prisma_client from '@prisma/client';
|
|
3
|
-
import { PrismaClient, Player, Prisma, EventBoosterType, Tournament,
|
|
4
|
-
export { EventBoosterType, Player, Prisma, Role,
|
|
3
|
+
import { PrismaClient, Player, Prisma, OpprPlayerRanking, OpprRankingChangeType, OpprRankingHistory, EventBoosterType, Tournament, Round, Match, MatchResult, Entry, Standing, User, ApiKey, Location } from '@prisma/client';
|
|
4
|
+
export { Entry, EventBoosterType, Location, Match, MatchResult, OpprPlayerRanking, OpprRankingChangeType, OpprRankingHistory, Player, Prisma, Role, Round, Standing, Tournament, User } from '@prisma/client';
|
|
5
5
|
|
|
6
6
|
declare const prisma: PrismaClient<_prisma_client.Prisma.PrismaClientOptions, never, _prisma_client_runtime_library.DefaultArgs>;
|
|
7
7
|
/**
|
|
@@ -27,23 +27,15 @@ interface CreatePlayerInput {
|
|
|
27
27
|
externalId?: string;
|
|
28
28
|
playerNumber?: number;
|
|
29
29
|
name?: string;
|
|
30
|
-
rating?: number;
|
|
31
|
-
ratingDeviation?: number;
|
|
32
|
-
ranking?: number;
|
|
33
|
-
isRated?: boolean;
|
|
34
30
|
eventCount?: number;
|
|
31
|
+
lastEventDate?: Date;
|
|
35
32
|
}
|
|
36
33
|
/**
|
|
37
34
|
* Input for updating a player
|
|
38
35
|
*/
|
|
39
36
|
interface UpdatePlayerInput {
|
|
40
37
|
name?: string;
|
|
41
|
-
rating?: number;
|
|
42
|
-
ratingDeviation?: number;
|
|
43
|
-
ranking?: number;
|
|
44
|
-
isRated?: boolean;
|
|
45
38
|
eventCount?: number;
|
|
46
|
-
lastRatingUpdate?: Date;
|
|
47
39
|
lastEventDate?: Date;
|
|
48
40
|
}
|
|
49
41
|
/**
|
|
@@ -80,26 +72,10 @@ declare function findPlayerByUserEmail(email: string, include?: Prisma.PlayerInc
|
|
|
80
72
|
* Finds multiple players with optional filters
|
|
81
73
|
*/
|
|
82
74
|
declare function findPlayers(options?: FindPlayersOptions): Promise<Player[]>;
|
|
83
|
-
/**
|
|
84
|
-
* Gets all rated players (has 5+ events)
|
|
85
|
-
*/
|
|
86
|
-
declare function getRatedPlayers(options?: Omit<FindPlayersOptions, 'where'>): Promise<Player[]>;
|
|
87
|
-
/**
|
|
88
|
-
* Gets top players by rating
|
|
89
|
-
*/
|
|
90
|
-
declare function getTopPlayersByRating(limit?: number): Promise<Player[]>;
|
|
91
|
-
/**
|
|
92
|
-
* Gets top players by ranking
|
|
93
|
-
*/
|
|
94
|
-
declare function getTopPlayersByRanking(limit?: number): Promise<Player[]>;
|
|
95
75
|
/**
|
|
96
76
|
* Updates a player
|
|
97
77
|
*/
|
|
98
78
|
declare function updatePlayer(id: string, data: UpdatePlayerInput): Promise<Player>;
|
|
99
|
-
/**
|
|
100
|
-
* Updates player rating after a tournament
|
|
101
|
-
*/
|
|
102
|
-
declare function updatePlayerRating(id: string, rating: number, ratingDeviation: number, eventCount?: number): Promise<Player>;
|
|
103
79
|
/**
|
|
104
80
|
* Deletes a player
|
|
105
81
|
*/
|
|
@@ -109,7 +85,7 @@ declare function deletePlayer(id: string): Promise<Player>;
|
|
|
109
85
|
*/
|
|
110
86
|
declare function countPlayers(where?: Prisma.PlayerWhereInput): Promise<number>;
|
|
111
87
|
/**
|
|
112
|
-
* Gets player with their tournament
|
|
88
|
+
* Gets player with their tournament standings
|
|
113
89
|
*/
|
|
114
90
|
declare function getPlayerWithResults(id: string): Promise<{
|
|
115
91
|
results: ({
|
|
@@ -119,8 +95,10 @@ declare function getPlayerWithResults(id: string): Promise<{
|
|
|
119
95
|
createdAt: Date;
|
|
120
96
|
updatedAt: Date;
|
|
121
97
|
externalId: string | null;
|
|
122
|
-
|
|
98
|
+
description: string | null;
|
|
123
99
|
date: Date;
|
|
100
|
+
locationId: string | null;
|
|
101
|
+
organizerId: string | null;
|
|
124
102
|
tgpConfig: Prisma.JsonValue | null;
|
|
125
103
|
eventBooster: _prisma_client.$Enums.EventBoosterType;
|
|
126
104
|
allowsOptOut: boolean;
|
|
@@ -136,9 +114,10 @@ declare function getPlayerWithResults(id: string): Promise<{
|
|
|
136
114
|
id: string;
|
|
137
115
|
createdAt: Date;
|
|
138
116
|
updatedAt: Date;
|
|
139
|
-
playerId: string;
|
|
140
117
|
tournamentId: string;
|
|
118
|
+
playerId: string;
|
|
141
119
|
position: number;
|
|
120
|
+
isFinals: boolean;
|
|
142
121
|
optedOut: boolean;
|
|
143
122
|
linearPoints: number | null;
|
|
144
123
|
dynamicPoints: number | null;
|
|
@@ -148,15 +127,17 @@ declare function getPlayerWithResults(id: string): Promise<{
|
|
|
148
127
|
decayedPoints: number | null;
|
|
149
128
|
efficiency: number | null;
|
|
150
129
|
})[];
|
|
151
|
-
|
|
130
|
+
standings: ({
|
|
152
131
|
tournament: {
|
|
153
132
|
name: string;
|
|
154
133
|
id: string;
|
|
155
134
|
createdAt: Date;
|
|
156
135
|
updatedAt: Date;
|
|
157
136
|
externalId: string | null;
|
|
158
|
-
|
|
137
|
+
description: string | null;
|
|
159
138
|
date: Date;
|
|
139
|
+
locationId: string | null;
|
|
140
|
+
organizerId: string | null;
|
|
160
141
|
tgpConfig: Prisma.JsonValue | null;
|
|
161
142
|
eventBooster: _prisma_client.$Enums.EventBoosterType;
|
|
162
143
|
allowsOptOut: boolean;
|
|
@@ -172,9 +153,10 @@ declare function getPlayerWithResults(id: string): Promise<{
|
|
|
172
153
|
id: string;
|
|
173
154
|
createdAt: Date;
|
|
174
155
|
updatedAt: Date;
|
|
175
|
-
playerId: string;
|
|
176
156
|
tournamentId: string;
|
|
157
|
+
playerId: string;
|
|
177
158
|
position: number;
|
|
159
|
+
isFinals: boolean;
|
|
178
160
|
optedOut: boolean;
|
|
179
161
|
linearPoints: number | null;
|
|
180
162
|
dynamicPoints: number | null;
|
|
@@ -190,12 +172,7 @@ declare function getPlayerWithResults(id: string): Promise<{
|
|
|
190
172
|
updatedAt: Date;
|
|
191
173
|
externalId: string | null;
|
|
192
174
|
playerNumber: number;
|
|
193
|
-
rating: number;
|
|
194
|
-
ratingDeviation: number;
|
|
195
|
-
ranking: number | null;
|
|
196
|
-
isRated: boolean;
|
|
197
175
|
eventCount: number;
|
|
198
|
-
lastRatingUpdate: Date;
|
|
199
176
|
lastEventDate: Date | null;
|
|
200
177
|
} | null>;
|
|
201
178
|
/**
|
|
@@ -203,6 +180,129 @@ declare function getPlayerWithResults(id: string): Promise<{
|
|
|
203
180
|
*/
|
|
204
181
|
declare function searchPlayers(query: string, limit?: number): Promise<Player[]>;
|
|
205
182
|
|
|
183
|
+
/**
|
|
184
|
+
* Input for creating a new OPPR player ranking
|
|
185
|
+
*/
|
|
186
|
+
interface CreateOpprPlayerRankingInput {
|
|
187
|
+
playerId: string;
|
|
188
|
+
rating?: number;
|
|
189
|
+
ratingDeviation?: number;
|
|
190
|
+
ranking?: number;
|
|
191
|
+
isRated?: boolean;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Input for updating an OPPR player ranking
|
|
195
|
+
*/
|
|
196
|
+
interface UpdateOpprPlayerRankingInput {
|
|
197
|
+
rating?: number;
|
|
198
|
+
ratingDeviation?: number;
|
|
199
|
+
ranking?: number;
|
|
200
|
+
isRated?: boolean;
|
|
201
|
+
lastRatingUpdate?: Date;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Options for querying OPPR rankings
|
|
205
|
+
*/
|
|
206
|
+
interface FindOpprPlayerRankingsOptions {
|
|
207
|
+
take?: number;
|
|
208
|
+
skip?: number;
|
|
209
|
+
orderBy?: Prisma.OpprPlayerRankingOrderByWithRelationInput;
|
|
210
|
+
where?: Prisma.OpprPlayerRankingWhereInput;
|
|
211
|
+
include?: Prisma.OpprPlayerRankingInclude;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Input for creating a ranking history record
|
|
215
|
+
*/
|
|
216
|
+
interface CreateOpprRankingHistoryInput {
|
|
217
|
+
opprPlayerRankingId: string;
|
|
218
|
+
rating: number;
|
|
219
|
+
ratingDeviation: number;
|
|
220
|
+
ranking?: number;
|
|
221
|
+
isRated: boolean;
|
|
222
|
+
changeType: OpprRankingChangeType;
|
|
223
|
+
tournamentId?: string;
|
|
224
|
+
notes?: string;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Gets or creates an OPPR player ranking for a player
|
|
228
|
+
*/
|
|
229
|
+
declare function getOrCreateOpprPlayerRanking(playerId: string): Promise<OpprPlayerRanking>;
|
|
230
|
+
/**
|
|
231
|
+
* Creates a new OPPR player ranking
|
|
232
|
+
*/
|
|
233
|
+
declare function createOpprPlayerRanking(data: CreateOpprPlayerRankingInput): Promise<OpprPlayerRanking>;
|
|
234
|
+
/**
|
|
235
|
+
* Finds OPPR ranking by ID
|
|
236
|
+
*/
|
|
237
|
+
declare function findOpprPlayerRankingById(id: string, include?: Prisma.OpprPlayerRankingInclude): Promise<OpprPlayerRanking | null>;
|
|
238
|
+
/**
|
|
239
|
+
* Finds OPPR ranking by player ID
|
|
240
|
+
*/
|
|
241
|
+
declare function findOpprPlayerRankingByPlayerId(playerId: string, include?: Prisma.OpprPlayerRankingInclude): Promise<OpprPlayerRanking | null>;
|
|
242
|
+
/**
|
|
243
|
+
* Finds multiple OPPR rankings with optional filters
|
|
244
|
+
*/
|
|
245
|
+
declare function findOpprPlayerRankings(options?: FindOpprPlayerRankingsOptions): Promise<OpprPlayerRanking[]>;
|
|
246
|
+
/**
|
|
247
|
+
* Gets all rated players ordered by rating (highest first)
|
|
248
|
+
*/
|
|
249
|
+
declare function getTopPlayersByOpprRating(limit?: number): Promise<OpprPlayerRanking[]>;
|
|
250
|
+
/**
|
|
251
|
+
* Gets all ranked players ordered by world ranking (best first)
|
|
252
|
+
*/
|
|
253
|
+
declare function getTopPlayersByOpprRanking(limit?: number): Promise<OpprPlayerRanking[]>;
|
|
254
|
+
/**
|
|
255
|
+
* Gets all rated players
|
|
256
|
+
*/
|
|
257
|
+
declare function getRatedOpprPlayers(options?: Omit<FindOpprPlayerRankingsOptions, 'where'>): Promise<OpprPlayerRanking[]>;
|
|
258
|
+
/**
|
|
259
|
+
* Updates OPPR player ranking
|
|
260
|
+
*/
|
|
261
|
+
declare function updateOpprPlayerRanking(playerId: string, data: UpdateOpprPlayerRankingInput): Promise<OpprPlayerRanking>;
|
|
262
|
+
/**
|
|
263
|
+
* Updates rating after a tournament and creates history record
|
|
264
|
+
*/
|
|
265
|
+
declare function updateOpprRatingAfterTournament(playerId: string, newRating: number, newRD: number, tournamentId: string, eventCount?: number): Promise<OpprPlayerRanking>;
|
|
266
|
+
/**
|
|
267
|
+
* Updates world rankings for all players (batch operation)
|
|
268
|
+
*/
|
|
269
|
+
declare function updateWorldRankings(rankings: Array<{
|
|
270
|
+
playerId: string;
|
|
271
|
+
ranking: number;
|
|
272
|
+
}>): Promise<void>;
|
|
273
|
+
/**
|
|
274
|
+
* Applies RD decay for inactive players
|
|
275
|
+
*/
|
|
276
|
+
declare function applyRDDecayForInactivePlayers(thresholdDays?: number, decayPerDay?: number, maxRD?: number): Promise<number>;
|
|
277
|
+
/**
|
|
278
|
+
* Deletes OPPR player ranking (cascades to history)
|
|
279
|
+
*/
|
|
280
|
+
declare function deleteOpprPlayerRanking(playerId: string): Promise<OpprPlayerRanking>;
|
|
281
|
+
/**
|
|
282
|
+
* Counts OPPR rankings
|
|
283
|
+
*/
|
|
284
|
+
declare function countOpprPlayerRankings(where?: Prisma.OpprPlayerRankingWhereInput): Promise<number>;
|
|
285
|
+
/**
|
|
286
|
+
* Creates a ranking history record
|
|
287
|
+
*/
|
|
288
|
+
declare function createOpprRankingHistory(data: CreateOpprRankingHistoryInput): Promise<OpprRankingHistory>;
|
|
289
|
+
/**
|
|
290
|
+
* Gets ranking history for a player
|
|
291
|
+
*/
|
|
292
|
+
declare function getOpprRankingHistory(playerId: string, limit?: number): Promise<OpprRankingHistory[]>;
|
|
293
|
+
/**
|
|
294
|
+
* Gets ranking history for a specific time period
|
|
295
|
+
*/
|
|
296
|
+
declare function getOpprRankingHistoryByDateRange(playerId: string, startDate: Date, endDate: Date): Promise<OpprRankingHistory[]>;
|
|
297
|
+
/**
|
|
298
|
+
* Gets the most recent history record for a player
|
|
299
|
+
*/
|
|
300
|
+
declare function getLatestOpprRankingHistory(playerId: string): Promise<OpprRankingHistory | null>;
|
|
301
|
+
/**
|
|
302
|
+
* Counts ranking history records
|
|
303
|
+
*/
|
|
304
|
+
declare function countOpprRankingHistory(where?: Prisma.OpprRankingHistoryWhereInput): Promise<number>;
|
|
305
|
+
|
|
206
306
|
/**
|
|
207
307
|
* Generates a unique player number with collision handling.
|
|
208
308
|
* Retries up to MAX_RETRIES times if collision occurs.
|
|
@@ -221,8 +321,10 @@ declare function isValidPlayerNumber(playerNumber: number): boolean;
|
|
|
221
321
|
interface CreateTournamentInput {
|
|
222
322
|
externalId?: string;
|
|
223
323
|
name: string;
|
|
224
|
-
|
|
324
|
+
description?: string;
|
|
225
325
|
date: Date;
|
|
326
|
+
locationId?: string;
|
|
327
|
+
organizerId?: string;
|
|
226
328
|
tgpConfig?: Prisma.InputJsonValue;
|
|
227
329
|
eventBooster?: EventBoosterType;
|
|
228
330
|
allowsOptOut?: boolean;
|
|
@@ -239,8 +341,10 @@ interface CreateTournamentInput {
|
|
|
239
341
|
*/
|
|
240
342
|
interface UpdateTournamentInput {
|
|
241
343
|
name?: string;
|
|
242
|
-
|
|
344
|
+
description?: string | null;
|
|
243
345
|
date?: Date;
|
|
346
|
+
locationId?: string | null;
|
|
347
|
+
organizerId?: string | null;
|
|
244
348
|
tgpConfig?: Prisma.InputJsonValue;
|
|
245
349
|
eventBooster?: EventBoosterType;
|
|
246
350
|
allowsOptOut?: boolean;
|
|
@@ -307,10 +411,10 @@ declare function deleteTournament(id: string): Promise<Tournament>;
|
|
|
307
411
|
*/
|
|
308
412
|
declare function countTournaments(where?: Prisma.TournamentWhereInput): Promise<number>;
|
|
309
413
|
/**
|
|
310
|
-
* Gets tournament with all
|
|
414
|
+
* Gets tournament with all standings and player details
|
|
311
415
|
*/
|
|
312
416
|
declare function getTournamentWithResults(id: string): Promise<({
|
|
313
|
-
|
|
417
|
+
standings: ({
|
|
314
418
|
player: {
|
|
315
419
|
name: string | null;
|
|
316
420
|
id: string;
|
|
@@ -318,21 +422,17 @@ declare function getTournamentWithResults(id: string): Promise<({
|
|
|
318
422
|
updatedAt: Date;
|
|
319
423
|
externalId: string | null;
|
|
320
424
|
playerNumber: number;
|
|
321
|
-
rating: number;
|
|
322
|
-
ratingDeviation: number;
|
|
323
|
-
ranking: number | null;
|
|
324
|
-
isRated: boolean;
|
|
325
425
|
eventCount: number;
|
|
326
|
-
lastRatingUpdate: Date;
|
|
327
426
|
lastEventDate: Date | null;
|
|
328
427
|
};
|
|
329
428
|
} & {
|
|
330
429
|
id: string;
|
|
331
430
|
createdAt: Date;
|
|
332
431
|
updatedAt: Date;
|
|
333
|
-
playerId: string;
|
|
334
432
|
tournamentId: string;
|
|
433
|
+
playerId: string;
|
|
335
434
|
position: number;
|
|
435
|
+
isFinals: boolean;
|
|
336
436
|
optedOut: boolean;
|
|
337
437
|
linearPoints: number | null;
|
|
338
438
|
dynamicPoints: number | null;
|
|
@@ -348,8 +448,75 @@ declare function getTournamentWithResults(id: string): Promise<({
|
|
|
348
448
|
createdAt: Date;
|
|
349
449
|
updatedAt: Date;
|
|
350
450
|
externalId: string | null;
|
|
351
|
-
|
|
451
|
+
description: string | null;
|
|
452
|
+
date: Date;
|
|
453
|
+
locationId: string | null;
|
|
454
|
+
organizerId: string | null;
|
|
455
|
+
tgpConfig: Prisma.JsonValue | null;
|
|
456
|
+
eventBooster: _prisma_client.$Enums.EventBoosterType;
|
|
457
|
+
allowsOptOut: boolean;
|
|
458
|
+
baseValue: number | null;
|
|
459
|
+
tvaRating: number | null;
|
|
460
|
+
tvaRanking: number | null;
|
|
461
|
+
totalTVA: number | null;
|
|
462
|
+
tgp: number | null;
|
|
463
|
+
eventBoosterMultiplier: number | null;
|
|
464
|
+
firstPlaceValue: number | null;
|
|
465
|
+
}) | null>;
|
|
466
|
+
/**
|
|
467
|
+
* Gets tournament with rounds, matches, and entries
|
|
468
|
+
*/
|
|
469
|
+
declare function getTournamentWithMatches(id: string): Promise<({
|
|
470
|
+
rounds: ({
|
|
471
|
+
matches: ({
|
|
472
|
+
entries: ({
|
|
473
|
+
player: {
|
|
474
|
+
name: string | null;
|
|
475
|
+
id: string;
|
|
476
|
+
createdAt: Date;
|
|
477
|
+
updatedAt: Date;
|
|
478
|
+
externalId: string | null;
|
|
479
|
+
playerNumber: number;
|
|
480
|
+
eventCount: number;
|
|
481
|
+
lastEventDate: Date | null;
|
|
482
|
+
};
|
|
483
|
+
} & {
|
|
484
|
+
result: _prisma_client.$Enums.MatchResult;
|
|
485
|
+
id: string;
|
|
486
|
+
createdAt: Date;
|
|
487
|
+
updatedAt: Date;
|
|
488
|
+
playerId: string;
|
|
489
|
+
position: number | null;
|
|
490
|
+
matchId: string;
|
|
491
|
+
})[];
|
|
492
|
+
} & {
|
|
493
|
+
number: number | null;
|
|
494
|
+
id: string;
|
|
495
|
+
createdAt: Date;
|
|
496
|
+
updatedAt: Date;
|
|
497
|
+
tournamentId: string;
|
|
498
|
+
roundId: string | null;
|
|
499
|
+
machineName: string | null;
|
|
500
|
+
})[];
|
|
501
|
+
} & {
|
|
502
|
+
number: number;
|
|
503
|
+
name: string | null;
|
|
504
|
+
id: string;
|
|
505
|
+
createdAt: Date;
|
|
506
|
+
updatedAt: Date;
|
|
507
|
+
tournamentId: string;
|
|
508
|
+
isFinals: boolean;
|
|
509
|
+
})[];
|
|
510
|
+
} & {
|
|
511
|
+
name: string;
|
|
512
|
+
id: string;
|
|
513
|
+
createdAt: Date;
|
|
514
|
+
updatedAt: Date;
|
|
515
|
+
externalId: string | null;
|
|
516
|
+
description: string | null;
|
|
352
517
|
date: Date;
|
|
518
|
+
locationId: string | null;
|
|
519
|
+
organizerId: string | null;
|
|
353
520
|
tgpConfig: Prisma.JsonValue | null;
|
|
354
521
|
eventBooster: _prisma_client.$Enums.EventBoosterType;
|
|
355
522
|
allowsOptOut: boolean;
|
|
@@ -362,7 +529,7 @@ declare function getTournamentWithResults(id: string): Promise<({
|
|
|
362
529
|
firstPlaceValue: number | null;
|
|
363
530
|
}) | null>;
|
|
364
531
|
/**
|
|
365
|
-
* Searches tournaments by name or location
|
|
532
|
+
* Searches tournaments by name or location name
|
|
366
533
|
*/
|
|
367
534
|
declare function searchTournaments(query: string, limit?: number): Promise<Tournament[]>;
|
|
368
535
|
/**
|
|
@@ -370,7 +537,7 @@ declare function searchTournaments(query: string, limit?: number): Promise<Tourn
|
|
|
370
537
|
*/
|
|
371
538
|
declare function getTournamentStats(id: string): Promise<{
|
|
372
539
|
tournament: {
|
|
373
|
-
|
|
540
|
+
standings: ({
|
|
374
541
|
player: {
|
|
375
542
|
name: string | null;
|
|
376
543
|
id: string;
|
|
@@ -378,21 +545,17 @@ declare function getTournamentStats(id: string): Promise<{
|
|
|
378
545
|
updatedAt: Date;
|
|
379
546
|
externalId: string | null;
|
|
380
547
|
playerNumber: number;
|
|
381
|
-
rating: number;
|
|
382
|
-
ratingDeviation: number;
|
|
383
|
-
ranking: number | null;
|
|
384
|
-
isRated: boolean;
|
|
385
548
|
eventCount: number;
|
|
386
|
-
lastRatingUpdate: Date;
|
|
387
549
|
lastEventDate: Date | null;
|
|
388
550
|
};
|
|
389
551
|
} & {
|
|
390
552
|
id: string;
|
|
391
553
|
createdAt: Date;
|
|
392
554
|
updatedAt: Date;
|
|
393
|
-
playerId: string;
|
|
394
555
|
tournamentId: string;
|
|
556
|
+
playerId: string;
|
|
395
557
|
position: number;
|
|
558
|
+
isFinals: boolean;
|
|
396
559
|
optedOut: boolean;
|
|
397
560
|
linearPoints: number | null;
|
|
398
561
|
dynamicPoints: number | null;
|
|
@@ -408,8 +571,10 @@ declare function getTournamentStats(id: string): Promise<{
|
|
|
408
571
|
createdAt: Date;
|
|
409
572
|
updatedAt: Date;
|
|
410
573
|
externalId: string | null;
|
|
411
|
-
|
|
574
|
+
description: string | null;
|
|
412
575
|
date: Date;
|
|
576
|
+
locationId: string | null;
|
|
577
|
+
organizerId: string | null;
|
|
413
578
|
tgpConfig: Prisma.JsonValue | null;
|
|
414
579
|
eventBooster: _prisma_client.$Enums.EventBoosterType;
|
|
415
580
|
allowsOptOut: boolean;
|
|
@@ -429,12 +594,342 @@ declare function getTournamentStats(id: string): Promise<{
|
|
|
429
594
|
} | null>;
|
|
430
595
|
|
|
431
596
|
/**
|
|
432
|
-
* Input for creating a
|
|
597
|
+
* Input for creating a new round
|
|
598
|
+
*/
|
|
599
|
+
interface CreateRoundInput {
|
|
600
|
+
tournamentId: string;
|
|
601
|
+
number: number;
|
|
602
|
+
name?: string;
|
|
603
|
+
isFinals?: boolean;
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* Input for updating a round
|
|
607
|
+
*/
|
|
608
|
+
interface UpdateRoundInput {
|
|
609
|
+
number?: number;
|
|
610
|
+
name?: string;
|
|
611
|
+
isFinals?: boolean;
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* Options for querying rounds
|
|
615
|
+
*/
|
|
616
|
+
interface FindRoundsOptions {
|
|
617
|
+
take?: number;
|
|
618
|
+
skip?: number;
|
|
619
|
+
orderBy?: Prisma.RoundOrderByWithRelationInput | Prisma.RoundOrderByWithRelationInput[];
|
|
620
|
+
where?: Prisma.RoundWhereInput;
|
|
621
|
+
include?: Prisma.RoundInclude;
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Creates a new round
|
|
625
|
+
*/
|
|
626
|
+
declare function createRound(data: CreateRoundInput): Promise<Round>;
|
|
627
|
+
/**
|
|
628
|
+
* Creates multiple rounds at once
|
|
629
|
+
*/
|
|
630
|
+
declare function createManyRounds(data: CreateRoundInput[]): Promise<Prisma.BatchPayload>;
|
|
631
|
+
/**
|
|
632
|
+
* Finds a round by ID
|
|
633
|
+
*/
|
|
634
|
+
declare function findRoundById(id: string, include?: Prisma.RoundInclude): Promise<Round | null>;
|
|
635
|
+
/**
|
|
636
|
+
* Finds a round by tournament, number, and isFinals
|
|
637
|
+
*/
|
|
638
|
+
declare function findRoundByTournamentAndNumber(tournamentId: string, number: number, isFinals: boolean, include?: Prisma.RoundInclude): Promise<Round | null>;
|
|
639
|
+
/**
|
|
640
|
+
* Finds multiple rounds with optional filters
|
|
641
|
+
*/
|
|
642
|
+
declare function findRounds(options?: FindRoundsOptions): Promise<Round[]>;
|
|
643
|
+
/**
|
|
644
|
+
* Gets all rounds for a specific tournament
|
|
645
|
+
*/
|
|
646
|
+
declare function getTournamentRounds(tournamentId: string, options?: Omit<FindRoundsOptions, 'where'>): Promise<Round[]>;
|
|
647
|
+
/**
|
|
648
|
+
* Gets qualifying rounds for a tournament
|
|
649
|
+
*/
|
|
650
|
+
declare function getQualifyingRounds(tournamentId: string, options?: Omit<FindRoundsOptions, 'where'>): Promise<Round[]>;
|
|
651
|
+
/**
|
|
652
|
+
* Gets finals rounds for a tournament
|
|
653
|
+
*/
|
|
654
|
+
declare function getFinalsRounds(tournamentId: string, options?: Omit<FindRoundsOptions, 'where'>): Promise<Round[]>;
|
|
655
|
+
/**
|
|
656
|
+
* Updates a round
|
|
657
|
+
*/
|
|
658
|
+
declare function updateRound(id: string, data: UpdateRoundInput): Promise<Round>;
|
|
659
|
+
/**
|
|
660
|
+
* Deletes a round
|
|
661
|
+
*/
|
|
662
|
+
declare function deleteRound(id: string): Promise<Round>;
|
|
663
|
+
/**
|
|
664
|
+
* Deletes all rounds for a tournament
|
|
665
|
+
*/
|
|
666
|
+
declare function deleteRoundsByTournament(tournamentId: string): Promise<Prisma.BatchPayload>;
|
|
667
|
+
/**
|
|
668
|
+
* Counts total rounds
|
|
669
|
+
*/
|
|
670
|
+
declare function countRounds(where?: Prisma.RoundWhereInput): Promise<number>;
|
|
671
|
+
/**
|
|
672
|
+
* Gets a round with all its matches
|
|
673
|
+
*/
|
|
674
|
+
declare function getRoundWithMatches(id: string): Promise<({
|
|
675
|
+
matches: ({
|
|
676
|
+
entries: ({
|
|
677
|
+
player: {
|
|
678
|
+
name: string | null;
|
|
679
|
+
id: string;
|
|
680
|
+
createdAt: Date;
|
|
681
|
+
updatedAt: Date;
|
|
682
|
+
externalId: string | null;
|
|
683
|
+
playerNumber: number;
|
|
684
|
+
eventCount: number;
|
|
685
|
+
lastEventDate: Date | null;
|
|
686
|
+
};
|
|
687
|
+
} & {
|
|
688
|
+
result: _prisma_client.$Enums.MatchResult;
|
|
689
|
+
id: string;
|
|
690
|
+
createdAt: Date;
|
|
691
|
+
updatedAt: Date;
|
|
692
|
+
playerId: string;
|
|
693
|
+
position: number | null;
|
|
694
|
+
matchId: string;
|
|
695
|
+
})[];
|
|
696
|
+
} & {
|
|
697
|
+
number: number | null;
|
|
698
|
+
id: string;
|
|
699
|
+
createdAt: Date;
|
|
700
|
+
updatedAt: Date;
|
|
701
|
+
tournamentId: string;
|
|
702
|
+
roundId: string | null;
|
|
703
|
+
machineName: string | null;
|
|
704
|
+
})[];
|
|
705
|
+
} & {
|
|
706
|
+
number: number;
|
|
707
|
+
name: string | null;
|
|
708
|
+
id: string;
|
|
709
|
+
createdAt: Date;
|
|
710
|
+
updatedAt: Date;
|
|
711
|
+
tournamentId: string;
|
|
712
|
+
isFinals: boolean;
|
|
713
|
+
}) | null>;
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Input for creating a new match
|
|
717
|
+
*/
|
|
718
|
+
interface CreateMatchInput {
|
|
719
|
+
tournamentId: string;
|
|
720
|
+
roundId?: string;
|
|
721
|
+
number?: number;
|
|
722
|
+
machineName?: string;
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* Input for updating a match
|
|
726
|
+
*/
|
|
727
|
+
interface UpdateMatchInput {
|
|
728
|
+
roundId?: string | null;
|
|
729
|
+
number?: number;
|
|
730
|
+
machineName?: string;
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* Options for querying matches
|
|
433
734
|
*/
|
|
434
|
-
interface
|
|
735
|
+
interface FindMatchesOptions {
|
|
736
|
+
take?: number;
|
|
737
|
+
skip?: number;
|
|
738
|
+
orderBy?: Prisma.MatchOrderByWithRelationInput | Prisma.MatchOrderByWithRelationInput[];
|
|
739
|
+
where?: Prisma.MatchWhereInput;
|
|
740
|
+
include?: Prisma.MatchInclude;
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Creates a new match
|
|
744
|
+
*/
|
|
745
|
+
declare function createMatch(data: CreateMatchInput): Promise<Match>;
|
|
746
|
+
/**
|
|
747
|
+
* Creates multiple matches at once
|
|
748
|
+
*/
|
|
749
|
+
declare function createManyMatches(data: CreateMatchInput[]): Promise<Prisma.BatchPayload>;
|
|
750
|
+
/**
|
|
751
|
+
* Finds a match by ID
|
|
752
|
+
*/
|
|
753
|
+
declare function findMatchById(id: string, include?: Prisma.MatchInclude): Promise<Match | null>;
|
|
754
|
+
/**
|
|
755
|
+
* Finds multiple matches with optional filters
|
|
756
|
+
*/
|
|
757
|
+
declare function findMatches(options?: FindMatchesOptions): Promise<Match[]>;
|
|
758
|
+
/**
|
|
759
|
+
* Gets all matches for a specific tournament
|
|
760
|
+
*/
|
|
761
|
+
declare function getTournamentMatches(tournamentId: string, options?: Omit<FindMatchesOptions, 'where'>): Promise<Match[]>;
|
|
762
|
+
/**
|
|
763
|
+
* Gets all matches for a specific round
|
|
764
|
+
*/
|
|
765
|
+
declare function getRoundMatches(roundId: string, options?: Omit<FindMatchesOptions, 'where'>): Promise<Match[]>;
|
|
766
|
+
/**
|
|
767
|
+
* Updates a match
|
|
768
|
+
*/
|
|
769
|
+
declare function updateMatch(id: string, data: UpdateMatchInput): Promise<Match>;
|
|
770
|
+
/**
|
|
771
|
+
* Deletes a match
|
|
772
|
+
*/
|
|
773
|
+
declare function deleteMatch(id: string): Promise<Match>;
|
|
774
|
+
/**
|
|
775
|
+
* Deletes all matches for a tournament
|
|
776
|
+
*/
|
|
777
|
+
declare function deleteMatchesByTournament(tournamentId: string): Promise<Prisma.BatchPayload>;
|
|
778
|
+
/**
|
|
779
|
+
* Deletes all matches for a round
|
|
780
|
+
*/
|
|
781
|
+
declare function deleteMatchesByRound(roundId: string): Promise<Prisma.BatchPayload>;
|
|
782
|
+
/**
|
|
783
|
+
* Counts total matches
|
|
784
|
+
*/
|
|
785
|
+
declare function countMatches(where?: Prisma.MatchWhereInput): Promise<number>;
|
|
786
|
+
/**
|
|
787
|
+
* Gets a match with all its entries and player details
|
|
788
|
+
*/
|
|
789
|
+
declare function getMatchWithEntries(id: string): Promise<({
|
|
790
|
+
round: {
|
|
791
|
+
number: number;
|
|
792
|
+
name: string | null;
|
|
793
|
+
id: string;
|
|
794
|
+
createdAt: Date;
|
|
795
|
+
updatedAt: Date;
|
|
796
|
+
tournamentId: string;
|
|
797
|
+
isFinals: boolean;
|
|
798
|
+
} | null;
|
|
799
|
+
entries: ({
|
|
800
|
+
player: {
|
|
801
|
+
name: string | null;
|
|
802
|
+
id: string;
|
|
803
|
+
createdAt: Date;
|
|
804
|
+
updatedAt: Date;
|
|
805
|
+
externalId: string | null;
|
|
806
|
+
playerNumber: number;
|
|
807
|
+
eventCount: number;
|
|
808
|
+
lastEventDate: Date | null;
|
|
809
|
+
};
|
|
810
|
+
} & {
|
|
811
|
+
result: _prisma_client.$Enums.MatchResult;
|
|
812
|
+
id: string;
|
|
813
|
+
createdAt: Date;
|
|
814
|
+
updatedAt: Date;
|
|
815
|
+
playerId: string;
|
|
816
|
+
position: number | null;
|
|
817
|
+
matchId: string;
|
|
818
|
+
})[];
|
|
819
|
+
} & {
|
|
820
|
+
number: number | null;
|
|
821
|
+
id: string;
|
|
822
|
+
createdAt: Date;
|
|
823
|
+
updatedAt: Date;
|
|
824
|
+
tournamentId: string;
|
|
825
|
+
roundId: string | null;
|
|
826
|
+
machineName: string | null;
|
|
827
|
+
}) | null>;
|
|
828
|
+
/**
|
|
829
|
+
* Gets matches for a player in a tournament
|
|
830
|
+
*/
|
|
831
|
+
declare function getPlayerTournamentMatches(playerId: string, tournamentId: string, include?: Prisma.MatchInclude): Promise<Match[]>;
|
|
832
|
+
|
|
833
|
+
/**
|
|
834
|
+
* Input for creating a new entry
|
|
835
|
+
*/
|
|
836
|
+
interface CreateEntryInput {
|
|
837
|
+
matchId: string;
|
|
435
838
|
playerId: string;
|
|
839
|
+
result: MatchResult;
|
|
840
|
+
position?: number;
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* Input for updating an entry
|
|
844
|
+
*/
|
|
845
|
+
interface UpdateEntryInput {
|
|
846
|
+
result?: MatchResult;
|
|
847
|
+
position?: number;
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* Options for querying entries
|
|
851
|
+
*/
|
|
852
|
+
interface FindEntriesOptions {
|
|
853
|
+
take?: number;
|
|
854
|
+
skip?: number;
|
|
855
|
+
orderBy?: Prisma.EntryOrderByWithRelationInput;
|
|
856
|
+
where?: Prisma.EntryWhereInput;
|
|
857
|
+
include?: Prisma.EntryInclude;
|
|
858
|
+
}
|
|
859
|
+
/**
|
|
860
|
+
* Creates a new entry
|
|
861
|
+
*/
|
|
862
|
+
declare function createEntry(data: CreateEntryInput): Promise<Entry>;
|
|
863
|
+
/**
|
|
864
|
+
* Creates multiple entries at once
|
|
865
|
+
*/
|
|
866
|
+
declare function createManyEntries(data: CreateEntryInput[]): Promise<Prisma.BatchPayload>;
|
|
867
|
+
/**
|
|
868
|
+
* Finds an entry by ID
|
|
869
|
+
*/
|
|
870
|
+
declare function findEntryById(id: string, include?: Prisma.EntryInclude): Promise<Entry | null>;
|
|
871
|
+
/**
|
|
872
|
+
* Finds an entry by match and player
|
|
873
|
+
*/
|
|
874
|
+
declare function findEntryByMatchAndPlayer(matchId: string, playerId: string, include?: Prisma.EntryInclude): Promise<Entry | null>;
|
|
875
|
+
/**
|
|
876
|
+
* Finds multiple entries with optional filters
|
|
877
|
+
*/
|
|
878
|
+
declare function findEntries(options?: FindEntriesOptions): Promise<Entry[]>;
|
|
879
|
+
/**
|
|
880
|
+
* Gets all entries for a specific match
|
|
881
|
+
*/
|
|
882
|
+
declare function getMatchEntries(matchId: string, options?: Omit<FindEntriesOptions, 'where'>): Promise<Entry[]>;
|
|
883
|
+
/**
|
|
884
|
+
* Gets all entries for a specific player
|
|
885
|
+
*/
|
|
886
|
+
declare function getPlayerEntries(playerId: string, options?: Omit<FindEntriesOptions, 'where'>): Promise<Entry[]>;
|
|
887
|
+
/**
|
|
888
|
+
* Gets player entries in a tournament
|
|
889
|
+
*/
|
|
890
|
+
declare function getPlayerTournamentEntries(playerId: string, tournamentId: string, include?: Prisma.EntryInclude): Promise<Entry[]>;
|
|
891
|
+
/**
|
|
892
|
+
* Updates an entry
|
|
893
|
+
*/
|
|
894
|
+
declare function updateEntry(id: string, data: UpdateEntryInput): Promise<Entry>;
|
|
895
|
+
/**
|
|
896
|
+
* Deletes an entry
|
|
897
|
+
*/
|
|
898
|
+
declare function deleteEntry(id: string): Promise<Entry>;
|
|
899
|
+
/**
|
|
900
|
+
* Deletes all entries for a match
|
|
901
|
+
*/
|
|
902
|
+
declare function deleteEntriesByMatch(matchId: string): Promise<Prisma.BatchPayload>;
|
|
903
|
+
/**
|
|
904
|
+
* Counts total entries
|
|
905
|
+
*/
|
|
906
|
+
declare function countEntries(where?: Prisma.EntryWhereInput): Promise<number>;
|
|
907
|
+
/**
|
|
908
|
+
* Gets player statistics from entries
|
|
909
|
+
*/
|
|
910
|
+
declare function getPlayerEntryStats(playerId: string): Promise<{
|
|
911
|
+
totalMatches: number;
|
|
912
|
+
wins: number;
|
|
913
|
+
losses: number;
|
|
914
|
+
ties: number;
|
|
915
|
+
winRate: number;
|
|
916
|
+
} | null>;
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* Merged standing with calculated position for points
|
|
920
|
+
*/
|
|
921
|
+
interface MergedStanding extends Standing {
|
|
922
|
+
mergedPosition: number;
|
|
923
|
+
isFinalist: boolean;
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* Input for creating a new standing
|
|
927
|
+
*/
|
|
928
|
+
interface CreateStandingInput {
|
|
436
929
|
tournamentId: string;
|
|
930
|
+
playerId: string;
|
|
437
931
|
position: number;
|
|
932
|
+
isFinals?: boolean;
|
|
438
933
|
optedOut?: boolean;
|
|
439
934
|
linearPoints?: number;
|
|
440
935
|
dynamicPoints?: number;
|
|
@@ -445,9 +940,9 @@ interface CreateResultInput {
|
|
|
445
940
|
efficiency?: number;
|
|
446
941
|
}
|
|
447
942
|
/**
|
|
448
|
-
* Input for updating a
|
|
943
|
+
* Input for updating a standing
|
|
449
944
|
*/
|
|
450
|
-
interface
|
|
945
|
+
interface UpdateStandingInput {
|
|
451
946
|
position?: number;
|
|
452
947
|
optedOut?: boolean;
|
|
453
948
|
linearPoints?: number;
|
|
@@ -459,67 +954,80 @@ interface UpdateResultInput {
|
|
|
459
954
|
efficiency?: number;
|
|
460
955
|
}
|
|
461
956
|
/**
|
|
462
|
-
* Options for querying
|
|
957
|
+
* Options for querying standings
|
|
463
958
|
*/
|
|
464
|
-
interface
|
|
959
|
+
interface FindStandingsOptions {
|
|
465
960
|
take?: number;
|
|
466
961
|
skip?: number;
|
|
467
|
-
orderBy?: Prisma.
|
|
468
|
-
where?: Prisma.
|
|
469
|
-
include?: Prisma.
|
|
962
|
+
orderBy?: Prisma.StandingOrderByWithRelationInput;
|
|
963
|
+
where?: Prisma.StandingWhereInput;
|
|
964
|
+
include?: Prisma.StandingInclude;
|
|
470
965
|
}
|
|
471
966
|
/**
|
|
472
|
-
* Creates a new
|
|
967
|
+
* Creates a new standing
|
|
473
968
|
*/
|
|
474
|
-
declare function
|
|
969
|
+
declare function createStanding(data: CreateStandingInput): Promise<Standing>;
|
|
475
970
|
/**
|
|
476
|
-
* Creates multiple
|
|
971
|
+
* Creates multiple standings at once
|
|
477
972
|
*/
|
|
478
|
-
declare function
|
|
973
|
+
declare function createManyStandings(data: CreateStandingInput[]): Promise<Prisma.BatchPayload>;
|
|
479
974
|
/**
|
|
480
|
-
* Finds a
|
|
975
|
+
* Finds a standing by ID
|
|
481
976
|
*/
|
|
482
|
-
declare function
|
|
977
|
+
declare function findStandingById(id: string, include?: Prisma.StandingInclude): Promise<Standing | null>;
|
|
483
978
|
/**
|
|
484
|
-
* Finds a
|
|
979
|
+
* Finds a standing by player, tournament, and isFinals
|
|
485
980
|
*/
|
|
486
|
-
declare function
|
|
981
|
+
declare function findStandingByPlayerAndTournament(playerId: string, tournamentId: string, isFinals: boolean, include?: Prisma.StandingInclude): Promise<Standing | null>;
|
|
487
982
|
/**
|
|
488
|
-
* Finds multiple
|
|
983
|
+
* Finds multiple standings with optional filters
|
|
489
984
|
*/
|
|
490
|
-
declare function
|
|
985
|
+
declare function findStandings(options?: FindStandingsOptions): Promise<Standing[]>;
|
|
491
986
|
/**
|
|
492
|
-
* Gets all
|
|
987
|
+
* Gets all standings for a specific player
|
|
493
988
|
*/
|
|
494
|
-
declare function
|
|
989
|
+
declare function getPlayerStandings(playerId: string, options?: Omit<FindStandingsOptions, 'where'>): Promise<Standing[]>;
|
|
495
990
|
/**
|
|
496
|
-
* Gets all
|
|
991
|
+
* Gets all standings for a specific tournament
|
|
497
992
|
*/
|
|
498
|
-
declare function
|
|
993
|
+
declare function getTournamentStandings(tournamentId: string, options?: Omit<FindStandingsOptions, 'where'>): Promise<Standing[]>;
|
|
994
|
+
/**
|
|
995
|
+
* Gets qualifying standings for a tournament
|
|
996
|
+
*/
|
|
997
|
+
declare function getQualifyingStandings(tournamentId: string, options?: Omit<FindStandingsOptions, 'where'>): Promise<Standing[]>;
|
|
998
|
+
/**
|
|
999
|
+
* Gets finals standings for a tournament
|
|
1000
|
+
*/
|
|
1001
|
+
declare function getFinalsStandings(tournamentId: string, options?: Omit<FindStandingsOptions, 'where'>): Promise<Standing[]>;
|
|
1002
|
+
/**
|
|
1003
|
+
* Gets merged standings for point calculation.
|
|
1004
|
+
* Finalists get their finals position, non-finalists get qualifying position + finalist count
|
|
1005
|
+
*/
|
|
1006
|
+
declare function getMergedStandings(tournamentId: string): Promise<MergedStanding[]>;
|
|
499
1007
|
/**
|
|
500
1008
|
* Gets top N finishes for a player
|
|
501
1009
|
*/
|
|
502
|
-
declare function getPlayerTopFinishes(playerId: string, limit?: number): Promise<
|
|
1010
|
+
declare function getPlayerTopFinishes(playerId: string, limit?: number): Promise<Standing[]>;
|
|
503
1011
|
/**
|
|
504
|
-
* Updates a
|
|
1012
|
+
* Updates a standing
|
|
505
1013
|
*/
|
|
506
|
-
declare function
|
|
1014
|
+
declare function updateStanding(id: string, data: UpdateStandingInput): Promise<Standing>;
|
|
507
1015
|
/**
|
|
508
|
-
* Updates
|
|
1016
|
+
* Updates standing points and decay information
|
|
509
1017
|
*/
|
|
510
|
-
declare function
|
|
1018
|
+
declare function updateStandingPoints(id: string, linearPoints: number, dynamicPoints: number, totalPoints: number): Promise<Standing>;
|
|
511
1019
|
/**
|
|
512
|
-
* Deletes a
|
|
1020
|
+
* Deletes a standing
|
|
513
1021
|
*/
|
|
514
|
-
declare function
|
|
1022
|
+
declare function deleteStanding(id: string): Promise<Standing>;
|
|
515
1023
|
/**
|
|
516
|
-
* Deletes all
|
|
1024
|
+
* Deletes all standings for a tournament
|
|
517
1025
|
*/
|
|
518
|
-
declare function
|
|
1026
|
+
declare function deleteStandingsByTournament(tournamentId: string): Promise<Prisma.BatchPayload>;
|
|
519
1027
|
/**
|
|
520
|
-
* Counts total
|
|
1028
|
+
* Counts total standings
|
|
521
1029
|
*/
|
|
522
|
-
declare function
|
|
1030
|
+
declare function countStandings(where?: Prisma.StandingWhereInput): Promise<number>;
|
|
523
1031
|
/**
|
|
524
1032
|
* Gets player statistics across all tournaments
|
|
525
1033
|
*/
|
|
@@ -537,7 +1045,7 @@ declare function getPlayerStats(playerId: string): Promise<{
|
|
|
537
1045
|
highestPoints: number;
|
|
538
1046
|
} | null>;
|
|
539
1047
|
/**
|
|
540
|
-
* Calculates and updates time decay for all
|
|
1048
|
+
* Calculates and updates time decay for all standings
|
|
541
1049
|
* Based on OPPR time decay rules:
|
|
542
1050
|
* - 0-1 years: 100%
|
|
543
1051
|
* - 1-2 years: 75%
|
|
@@ -548,9 +1056,10 @@ declare function recalculateTimeDecay(referenceDate?: Date): Promise<{
|
|
|
548
1056
|
id: string;
|
|
549
1057
|
createdAt: Date;
|
|
550
1058
|
updatedAt: Date;
|
|
551
|
-
playerId: string;
|
|
552
1059
|
tournamentId: string;
|
|
1060
|
+
playerId: string;
|
|
553
1061
|
position: number;
|
|
1062
|
+
isFinals: boolean;
|
|
554
1063
|
optedOut: boolean;
|
|
555
1064
|
linearPoints: number | null;
|
|
556
1065
|
dynamicPoints: number | null;
|
|
@@ -569,6 +1078,9 @@ interface CreateUserInput {
|
|
|
569
1078
|
passwordHash: string;
|
|
570
1079
|
playerId?: string;
|
|
571
1080
|
role?: 'USER' | 'ADMIN';
|
|
1081
|
+
tosAcceptedAt?: Date;
|
|
1082
|
+
privacyPolicyAcceptedAt?: Date;
|
|
1083
|
+
codeOfConductAcceptedAt?: Date;
|
|
572
1084
|
}
|
|
573
1085
|
/**
|
|
574
1086
|
* Input for updating a user
|
|
@@ -589,14 +1101,13 @@ interface UserWithPlayer {
|
|
|
589
1101
|
role: 'USER' | 'ADMIN';
|
|
590
1102
|
createdAt: Date;
|
|
591
1103
|
updatedAt: Date;
|
|
1104
|
+
tosAcceptedAt: Date | null;
|
|
1105
|
+
privacyPolicyAcceptedAt: Date | null;
|
|
1106
|
+
codeOfConductAcceptedAt: Date | null;
|
|
592
1107
|
player: {
|
|
593
1108
|
id: string;
|
|
594
1109
|
playerNumber: number;
|
|
595
1110
|
name: string | null;
|
|
596
|
-
rating: number;
|
|
597
|
-
ratingDeviation: number;
|
|
598
|
-
ranking: number | null;
|
|
599
|
-
isRated: boolean;
|
|
600
1111
|
eventCount: number;
|
|
601
1112
|
} | null;
|
|
602
1113
|
}
|
|
@@ -662,26 +1173,205 @@ declare function findUsers(params: {
|
|
|
662
1173
|
*/
|
|
663
1174
|
declare function linkPlayerToUser(userId: string, playerId: string | null): Promise<UserWithPlayer>;
|
|
664
1175
|
|
|
1176
|
+
/**
|
|
1177
|
+
* Maximum number of API keys allowed per user
|
|
1178
|
+
*/
|
|
1179
|
+
declare const MAX_API_KEYS_PER_USER = 5;
|
|
1180
|
+
/**
|
|
1181
|
+
* Input for creating a new API key
|
|
1182
|
+
*/
|
|
1183
|
+
interface CreateApiKeyInput {
|
|
1184
|
+
name: string;
|
|
1185
|
+
keyPrefix: string;
|
|
1186
|
+
keyHash: string;
|
|
1187
|
+
userId: string;
|
|
1188
|
+
expiresAt?: Date | null;
|
|
1189
|
+
}
|
|
1190
|
+
/**
|
|
1191
|
+
* API key with user info (for authentication)
|
|
1192
|
+
*/
|
|
1193
|
+
interface ApiKeyWithUser {
|
|
1194
|
+
id: string;
|
|
1195
|
+
name: string;
|
|
1196
|
+
keyPrefix: string;
|
|
1197
|
+
keyHash: string;
|
|
1198
|
+
expiresAt: Date | null;
|
|
1199
|
+
lastUsedAt: Date | null;
|
|
1200
|
+
createdAt: Date;
|
|
1201
|
+
userId: string;
|
|
1202
|
+
user: {
|
|
1203
|
+
id: string;
|
|
1204
|
+
email: string;
|
|
1205
|
+
role: 'USER' | 'ADMIN';
|
|
1206
|
+
};
|
|
1207
|
+
}
|
|
1208
|
+
/**
|
|
1209
|
+
* API key info for listing (without sensitive data)
|
|
1210
|
+
*/
|
|
1211
|
+
interface ApiKeyInfo {
|
|
1212
|
+
id: string;
|
|
1213
|
+
name: string;
|
|
1214
|
+
keyPrefix: string;
|
|
1215
|
+
expiresAt: Date | null;
|
|
1216
|
+
lastUsedAt: Date | null;
|
|
1217
|
+
createdAt: Date;
|
|
1218
|
+
}
|
|
1219
|
+
/**
|
|
1220
|
+
* Creates a new API key
|
|
1221
|
+
*/
|
|
1222
|
+
declare function createApiKey(data: CreateApiKeyInput): Promise<ApiKey>;
|
|
1223
|
+
/**
|
|
1224
|
+
* Finds an API key by ID
|
|
1225
|
+
*/
|
|
1226
|
+
declare function findApiKeyById(id: string): Promise<ApiKey | null>;
|
|
1227
|
+
/**
|
|
1228
|
+
* Finds API keys by prefix with user data (for authentication)
|
|
1229
|
+
* Returns all keys matching the prefix so we can verify the hash
|
|
1230
|
+
*/
|
|
1231
|
+
declare function findApiKeysByPrefix(keyPrefix: string): Promise<ApiKeyWithUser[]>;
|
|
1232
|
+
/**
|
|
1233
|
+
* Gets all API keys for a user (without sensitive data)
|
|
1234
|
+
*/
|
|
1235
|
+
declare function getUserApiKeys(userId: string): Promise<ApiKeyInfo[]>;
|
|
1236
|
+
/**
|
|
1237
|
+
* Counts API keys for a user
|
|
1238
|
+
*/
|
|
1239
|
+
declare function countUserApiKeys(userId: string): Promise<number>;
|
|
1240
|
+
/**
|
|
1241
|
+
* Updates the lastUsedAt timestamp for an API key
|
|
1242
|
+
*/
|
|
1243
|
+
declare function updateApiKeyLastUsed(id: string): Promise<void>;
|
|
1244
|
+
/**
|
|
1245
|
+
* Deletes an API key
|
|
1246
|
+
*/
|
|
1247
|
+
declare function deleteApiKey(id: string): Promise<ApiKey>;
|
|
1248
|
+
/**
|
|
1249
|
+
* Deletes an API key only if it belongs to the specified user
|
|
1250
|
+
* Returns null if the key doesn't exist or doesn't belong to the user
|
|
1251
|
+
*/
|
|
1252
|
+
declare function deleteUserApiKey(id: string, userId: string): Promise<ApiKey | null>;
|
|
1253
|
+
|
|
1254
|
+
/**
|
|
1255
|
+
* Input for creating a new location
|
|
1256
|
+
*/
|
|
1257
|
+
interface CreateLocationInput {
|
|
1258
|
+
externalId?: string;
|
|
1259
|
+
name: string;
|
|
1260
|
+
address?: string;
|
|
1261
|
+
city?: string;
|
|
1262
|
+
state?: string;
|
|
1263
|
+
country?: string;
|
|
1264
|
+
}
|
|
1265
|
+
/**
|
|
1266
|
+
* Input for updating a location
|
|
1267
|
+
*/
|
|
1268
|
+
interface UpdateLocationInput {
|
|
1269
|
+
name?: string;
|
|
1270
|
+
address?: string | null;
|
|
1271
|
+
city?: string | null;
|
|
1272
|
+
state?: string | null;
|
|
1273
|
+
country?: string | null;
|
|
1274
|
+
}
|
|
1275
|
+
/**
|
|
1276
|
+
* Options for querying locations
|
|
1277
|
+
*/
|
|
1278
|
+
interface FindLocationsOptions {
|
|
1279
|
+
take?: number;
|
|
1280
|
+
skip?: number;
|
|
1281
|
+
orderBy?: Prisma.LocationOrderByWithRelationInput;
|
|
1282
|
+
where?: Prisma.LocationWhereInput;
|
|
1283
|
+
include?: Prisma.LocationInclude;
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* Creates a new location
|
|
1287
|
+
*/
|
|
1288
|
+
declare function createLocation(data: CreateLocationInput): Promise<Location>;
|
|
1289
|
+
/**
|
|
1290
|
+
* Finds a location by ID
|
|
1291
|
+
*/
|
|
1292
|
+
declare function findLocationById(id: string, include?: Prisma.LocationInclude): Promise<Location | null>;
|
|
1293
|
+
/**
|
|
1294
|
+
* Finds a location by external ID
|
|
1295
|
+
*/
|
|
1296
|
+
declare function findLocationByExternalId(externalId: string, include?: Prisma.LocationInclude): Promise<Location | null>;
|
|
1297
|
+
/**
|
|
1298
|
+
* Finds multiple locations with optional filters
|
|
1299
|
+
*/
|
|
1300
|
+
declare function findLocations(options?: FindLocationsOptions): Promise<Location[]>;
|
|
1301
|
+
/**
|
|
1302
|
+
* Searches locations by name or city
|
|
1303
|
+
*/
|
|
1304
|
+
declare function searchLocations(query: string, limit?: number): Promise<Location[]>;
|
|
1305
|
+
/**
|
|
1306
|
+
* Updates a location
|
|
1307
|
+
*/
|
|
1308
|
+
declare function updateLocation(id: string, data: UpdateLocationInput): Promise<Location>;
|
|
1309
|
+
/**
|
|
1310
|
+
* Deletes a location
|
|
1311
|
+
*/
|
|
1312
|
+
declare function deleteLocation(id: string): Promise<Location>;
|
|
1313
|
+
/**
|
|
1314
|
+
* Counts total locations
|
|
1315
|
+
*/
|
|
1316
|
+
declare function countLocations(where?: Prisma.LocationWhereInput): Promise<number>;
|
|
1317
|
+
/**
|
|
1318
|
+
* Gets location with its tournaments
|
|
1319
|
+
*/
|
|
1320
|
+
declare function getLocationWithTournaments(id: string): Promise<({
|
|
1321
|
+
tournaments: {
|
|
1322
|
+
name: string;
|
|
1323
|
+
id: string;
|
|
1324
|
+
createdAt: Date;
|
|
1325
|
+
updatedAt: Date;
|
|
1326
|
+
externalId: string | null;
|
|
1327
|
+
description: string | null;
|
|
1328
|
+
date: Date;
|
|
1329
|
+
locationId: string | null;
|
|
1330
|
+
organizerId: string | null;
|
|
1331
|
+
tgpConfig: Prisma.JsonValue | null;
|
|
1332
|
+
eventBooster: _prisma_client.$Enums.EventBoosterType;
|
|
1333
|
+
allowsOptOut: boolean;
|
|
1334
|
+
baseValue: number | null;
|
|
1335
|
+
tvaRating: number | null;
|
|
1336
|
+
tvaRanking: number | null;
|
|
1337
|
+
totalTVA: number | null;
|
|
1338
|
+
tgp: number | null;
|
|
1339
|
+
eventBoosterMultiplier: number | null;
|
|
1340
|
+
firstPlaceValue: number | null;
|
|
1341
|
+
}[];
|
|
1342
|
+
} & {
|
|
1343
|
+
name: string;
|
|
1344
|
+
id: string;
|
|
1345
|
+
createdAt: Date;
|
|
1346
|
+
updatedAt: Date;
|
|
1347
|
+
externalId: string | null;
|
|
1348
|
+
address: string | null;
|
|
1349
|
+
city: string | null;
|
|
1350
|
+
state: string | null;
|
|
1351
|
+
country: string | null;
|
|
1352
|
+
}) | null>;
|
|
1353
|
+
|
|
665
1354
|
/**
|
|
666
1355
|
* Re-export Prisma generated types
|
|
667
1356
|
*/
|
|
668
1357
|
|
|
669
1358
|
/**
|
|
670
|
-
* Player with full tournament
|
|
1359
|
+
* Player with full tournament standings
|
|
671
1360
|
*/
|
|
672
1361
|
interface PlayerWithResults {
|
|
673
1362
|
player: Player;
|
|
674
|
-
results:
|
|
1363
|
+
results: StandingWithTournament[];
|
|
675
1364
|
stats: PlayerStatistics;
|
|
676
1365
|
}
|
|
677
1366
|
/**
|
|
678
|
-
*
|
|
1367
|
+
* Standing with tournament details
|
|
679
1368
|
*/
|
|
680
|
-
interface
|
|
1369
|
+
interface StandingWithTournament {
|
|
681
1370
|
id: string;
|
|
682
1371
|
position: number;
|
|
683
|
-
|
|
684
|
-
|
|
1372
|
+
isFinals: boolean;
|
|
1373
|
+
totalPoints: number | null;
|
|
1374
|
+
decayedPoints: number | null;
|
|
685
1375
|
tournament: {
|
|
686
1376
|
id: string;
|
|
687
1377
|
name: string;
|
|
@@ -721,4 +1411,4 @@ interface ConnectionStatus {
|
|
|
721
1411
|
error?: string;
|
|
722
1412
|
}
|
|
723
1413
|
|
|
724
|
-
export { type ConnectionStatus, type CreatePlayerInput, type
|
|
1414
|
+
export { type ApiKeyInfo, type ApiKeyWithUser, type ConnectionStatus, type CreateApiKeyInput, type CreateEntryInput, type CreateLocationInput, type CreateMatchInput, type CreateOpprPlayerRankingInput, type CreateOpprRankingHistoryInput, type CreatePlayerInput, type CreateRoundInput, type CreateStandingInput, type CreateTournamentInput, type CreateUserInput, type FindEntriesOptions, type FindLocationsOptions, type FindMatchesOptions, type FindOpprPlayerRankingsOptions, type FindPlayersOptions, type FindRoundsOptions, type FindStandingsOptions, type FindTournamentsOptions, MAX_API_KEYS_PER_USER, type MergedStanding, type PlayerStatistics, type PlayerWithResults, type StandingWithTournament, type TournamentStatistics, type UpdateEntryInput, type UpdateLocationInput, type UpdateMatchInput, type UpdateOpprPlayerRankingInput, type UpdatePlayerInput, type UpdateRoundInput, type UpdateStandingInput, type UpdateTournamentInput, type UpdateUserInput, type UserWithPlayer, applyRDDecayForInactivePlayers, connect, countEntries, countLocations, countMatches, countOpprPlayerRankings, countOpprRankingHistory, countPlayers, countRounds, countStandings, countTournaments, countUserApiKeys, countUsers, createApiKey, createEntry, createLocation, createManyEntries, createManyMatches, createManyRounds, createManyStandings, createMatch, createOpprPlayerRanking, createOpprRankingHistory, createPlayer, createRound, createStanding, createTournament, createUser, createUserWithPlayer, deleteApiKey, deleteEntriesByMatch, deleteEntry, deleteLocation, deleteMatch, deleteMatchesByRound, deleteMatchesByTournament, deleteOpprPlayerRanking, deletePlayer, deleteRound, deleteRoundsByTournament, deleteStanding, deleteStandingsByTournament, deleteTournament, deleteUser, deleteUserApiKey, disconnect, findApiKeyById, findApiKeysByPrefix, findEntries, findEntryById, findEntryByMatchAndPlayer, findLocationByExternalId, findLocationById, findLocations, findMatchById, findMatches, findOpprPlayerRankingById, findOpprPlayerRankingByPlayerId, findOpprPlayerRankings, findPlayerByExternalId, findPlayerById, findPlayerByPlayerNumber, findPlayerByUserEmail, findPlayers, findRoundById, findRoundByTournamentAndNumber, findRounds, findStandingById, findStandingByPlayerAndTournament, findStandings, findTournamentByExternalId, findTournamentById, findTournaments, findUserByEmail, findUserById, findUsers, generateUniquePlayerNumber, getFinalsRounds, getFinalsStandings, getLatestOpprRankingHistory, getLocationWithTournaments, getMajorTournaments, getMatchEntries, getMatchWithEntries, getMergedStandings, getOpprRankingHistory, getOpprRankingHistoryByDateRange, getOrCreateOpprPlayerRanking, getPlayerEntries, getPlayerEntryStats, getPlayerStandings, getPlayerStats, getPlayerTopFinishes, getPlayerTournamentEntries, getPlayerTournamentMatches, getPlayerWithResults, getQualifyingRounds, getQualifyingStandings, getRatedOpprPlayers, getRecentTournaments, getRoundMatches, getRoundWithMatches, getTopPlayersByOpprRanking, getTopPlayersByOpprRating, getTournamentMatches, getTournamentRounds, getTournamentStandings, getTournamentStats, getTournamentWithMatches, getTournamentWithResults, getTournamentsByBoosterType, getTournamentsByDateRange, getUserApiKeys, getUserByEmailWithPlayer, getUserWithPlayer, isValidPlayerNumber, linkPlayerToUser, prisma, recalculateTimeDecay, searchLocations, searchPlayers, searchTournaments, testConnection, updateApiKeyLastUsed, updateEntry, updateLocation, updateMatch, updateOpprPlayerRanking, updateOpprRatingAfterTournament, updatePlayer, updateRound, updateStanding, updateStandingPoints, updateTournament, updateUser, updateUserRefreshToken, updateWorldRankings };
|