@opprs/db-prisma 0.5.2-canary.760356d
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/LICENSE +21 -0
- package/README.md +85 -0
- package/dist/index.cjs +573 -0
- package/dist/index.d.cts +608 -0
- package/dist/index.d.ts +608 -0
- package/dist/index.js +500 -0
- package/package.json +85 -0
- package/prisma/schema.prisma +123 -0
- package/prisma/seed.ts +349 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,608 @@
|
|
|
1
|
+
import * as _prisma_client_runtime_library from '@prisma/client/runtime/library';
|
|
2
|
+
import * as _prisma_client from '@prisma/client';
|
|
3
|
+
import { PrismaClient, Player, Prisma, EventBoosterType, Tournament, TournamentResult } from '@prisma/client';
|
|
4
|
+
export { EventBoosterType, Player, Prisma, Tournament, TournamentResult } from '@prisma/client';
|
|
5
|
+
|
|
6
|
+
declare const prisma: PrismaClient<_prisma_client.Prisma.PrismaClientOptions, never, _prisma_client_runtime_library.DefaultArgs>;
|
|
7
|
+
/**
|
|
8
|
+
* Disconnects from the database
|
|
9
|
+
* Useful for graceful shutdowns
|
|
10
|
+
*/
|
|
11
|
+
declare function disconnect(): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Connects to the database
|
|
14
|
+
* Usually not needed as Prisma connects automatically
|
|
15
|
+
*/
|
|
16
|
+
declare function connect(): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Tests the database connection
|
|
19
|
+
* @returns true if connection is successful
|
|
20
|
+
*/
|
|
21
|
+
declare function testConnection(): Promise<boolean>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Input for creating a new player
|
|
25
|
+
*/
|
|
26
|
+
interface CreatePlayerInput {
|
|
27
|
+
externalId?: string;
|
|
28
|
+
name?: string;
|
|
29
|
+
email?: string;
|
|
30
|
+
rating?: number;
|
|
31
|
+
ratingDeviation?: number;
|
|
32
|
+
ranking?: number;
|
|
33
|
+
isRated?: boolean;
|
|
34
|
+
eventCount?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Input for updating a player
|
|
38
|
+
*/
|
|
39
|
+
interface UpdatePlayerInput {
|
|
40
|
+
name?: string;
|
|
41
|
+
email?: string;
|
|
42
|
+
rating?: number;
|
|
43
|
+
ratingDeviation?: number;
|
|
44
|
+
ranking?: number;
|
|
45
|
+
isRated?: boolean;
|
|
46
|
+
eventCount?: number;
|
|
47
|
+
lastRatingUpdate?: Date;
|
|
48
|
+
lastEventDate?: Date;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Options for querying players
|
|
52
|
+
*/
|
|
53
|
+
interface FindPlayersOptions {
|
|
54
|
+
take?: number;
|
|
55
|
+
skip?: number;
|
|
56
|
+
orderBy?: Prisma.PlayerOrderByWithRelationInput;
|
|
57
|
+
where?: Prisma.PlayerWhereInput;
|
|
58
|
+
include?: Prisma.PlayerInclude;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Creates a new player
|
|
62
|
+
*/
|
|
63
|
+
declare function createPlayer(data: CreatePlayerInput): Promise<Player>;
|
|
64
|
+
/**
|
|
65
|
+
* Finds a player by ID
|
|
66
|
+
*/
|
|
67
|
+
declare function findPlayerById(id: string, include?: Prisma.PlayerInclude): Promise<Player | null>;
|
|
68
|
+
/**
|
|
69
|
+
* Finds a player by external ID
|
|
70
|
+
*/
|
|
71
|
+
declare function findPlayerByExternalId(externalId: string, include?: Prisma.PlayerInclude): Promise<Player | null>;
|
|
72
|
+
/**
|
|
73
|
+
* Finds a player by email
|
|
74
|
+
*/
|
|
75
|
+
declare function findPlayerByEmail(email: string, include?: Prisma.PlayerInclude): Promise<Player | null>;
|
|
76
|
+
/**
|
|
77
|
+
* Finds multiple players with optional filters
|
|
78
|
+
*/
|
|
79
|
+
declare function findPlayers(options?: FindPlayersOptions): Promise<Player[]>;
|
|
80
|
+
/**
|
|
81
|
+
* Gets all rated players (has 5+ events)
|
|
82
|
+
*/
|
|
83
|
+
declare function getRatedPlayers(options?: Omit<FindPlayersOptions, 'where'>): Promise<Player[]>;
|
|
84
|
+
/**
|
|
85
|
+
* Gets top players by rating
|
|
86
|
+
*/
|
|
87
|
+
declare function getTopPlayersByRating(limit?: number): Promise<Player[]>;
|
|
88
|
+
/**
|
|
89
|
+
* Gets top players by ranking
|
|
90
|
+
*/
|
|
91
|
+
declare function getTopPlayersByRanking(limit?: number): Promise<Player[]>;
|
|
92
|
+
/**
|
|
93
|
+
* Updates a player
|
|
94
|
+
*/
|
|
95
|
+
declare function updatePlayer(id: string, data: UpdatePlayerInput): Promise<Player>;
|
|
96
|
+
/**
|
|
97
|
+
* Updates player rating after a tournament
|
|
98
|
+
*/
|
|
99
|
+
declare function updatePlayerRating(id: string, rating: number, ratingDeviation: number, eventCount?: number): Promise<Player>;
|
|
100
|
+
/**
|
|
101
|
+
* Deletes a player
|
|
102
|
+
*/
|
|
103
|
+
declare function deletePlayer(id: string): Promise<Player>;
|
|
104
|
+
/**
|
|
105
|
+
* Counts total players
|
|
106
|
+
*/
|
|
107
|
+
declare function countPlayers(where?: Prisma.PlayerWhereInput): Promise<number>;
|
|
108
|
+
/**
|
|
109
|
+
* Gets player with their tournament results
|
|
110
|
+
*/
|
|
111
|
+
declare function getPlayerWithResults(id: string): Promise<{
|
|
112
|
+
results: ({
|
|
113
|
+
tournament: {
|
|
114
|
+
name: string;
|
|
115
|
+
id: string;
|
|
116
|
+
createdAt: Date;
|
|
117
|
+
updatedAt: Date;
|
|
118
|
+
externalId: string | null;
|
|
119
|
+
location: string | null;
|
|
120
|
+
date: Date;
|
|
121
|
+
tgpConfig: Prisma.JsonValue | null;
|
|
122
|
+
eventBooster: _prisma_client.$Enums.EventBoosterType;
|
|
123
|
+
allowsOptOut: boolean;
|
|
124
|
+
baseValue: number | null;
|
|
125
|
+
tvaRating: number | null;
|
|
126
|
+
tvaRanking: number | null;
|
|
127
|
+
totalTVA: number | null;
|
|
128
|
+
tgp: number | null;
|
|
129
|
+
eventBoosterMultiplier: number | null;
|
|
130
|
+
firstPlaceValue: number | null;
|
|
131
|
+
};
|
|
132
|
+
} & {
|
|
133
|
+
id: string;
|
|
134
|
+
createdAt: Date;
|
|
135
|
+
updatedAt: Date;
|
|
136
|
+
playerId: string;
|
|
137
|
+
tournamentId: string;
|
|
138
|
+
position: number;
|
|
139
|
+
optedOut: boolean;
|
|
140
|
+
linearPoints: number | null;
|
|
141
|
+
dynamicPoints: number | null;
|
|
142
|
+
totalPoints: number | null;
|
|
143
|
+
ageInDays: number | null;
|
|
144
|
+
decayMultiplier: number | null;
|
|
145
|
+
decayedPoints: number | null;
|
|
146
|
+
efficiency: number | null;
|
|
147
|
+
})[];
|
|
148
|
+
tournamentResults: ({
|
|
149
|
+
tournament: {
|
|
150
|
+
name: string;
|
|
151
|
+
id: string;
|
|
152
|
+
createdAt: Date;
|
|
153
|
+
updatedAt: Date;
|
|
154
|
+
externalId: string | null;
|
|
155
|
+
location: string | null;
|
|
156
|
+
date: Date;
|
|
157
|
+
tgpConfig: Prisma.JsonValue | null;
|
|
158
|
+
eventBooster: _prisma_client.$Enums.EventBoosterType;
|
|
159
|
+
allowsOptOut: boolean;
|
|
160
|
+
baseValue: number | null;
|
|
161
|
+
tvaRating: number | null;
|
|
162
|
+
tvaRanking: number | null;
|
|
163
|
+
totalTVA: number | null;
|
|
164
|
+
tgp: number | null;
|
|
165
|
+
eventBoosterMultiplier: number | null;
|
|
166
|
+
firstPlaceValue: number | null;
|
|
167
|
+
};
|
|
168
|
+
} & {
|
|
169
|
+
id: string;
|
|
170
|
+
createdAt: Date;
|
|
171
|
+
updatedAt: Date;
|
|
172
|
+
playerId: string;
|
|
173
|
+
tournamentId: string;
|
|
174
|
+
position: number;
|
|
175
|
+
optedOut: boolean;
|
|
176
|
+
linearPoints: number | null;
|
|
177
|
+
dynamicPoints: number | null;
|
|
178
|
+
totalPoints: number | null;
|
|
179
|
+
ageInDays: number | null;
|
|
180
|
+
decayMultiplier: number | null;
|
|
181
|
+
decayedPoints: number | null;
|
|
182
|
+
efficiency: number | null;
|
|
183
|
+
})[];
|
|
184
|
+
name: string | null;
|
|
185
|
+
id: string;
|
|
186
|
+
createdAt: Date;
|
|
187
|
+
updatedAt: Date;
|
|
188
|
+
externalId: string | null;
|
|
189
|
+
email: string | null;
|
|
190
|
+
rating: number;
|
|
191
|
+
ratingDeviation: number;
|
|
192
|
+
ranking: number | null;
|
|
193
|
+
isRated: boolean;
|
|
194
|
+
eventCount: number;
|
|
195
|
+
lastRatingUpdate: Date;
|
|
196
|
+
lastEventDate: Date | null;
|
|
197
|
+
} | null>;
|
|
198
|
+
/**
|
|
199
|
+
* Searches players by name or email
|
|
200
|
+
*/
|
|
201
|
+
declare function searchPlayers(query: string, limit?: number): Promise<Player[]>;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Input for creating a new tournament
|
|
205
|
+
*/
|
|
206
|
+
interface CreateTournamentInput {
|
|
207
|
+
externalId?: string;
|
|
208
|
+
name: string;
|
|
209
|
+
location?: string;
|
|
210
|
+
date: Date;
|
|
211
|
+
tgpConfig?: Prisma.InputJsonValue;
|
|
212
|
+
eventBooster?: EventBoosterType;
|
|
213
|
+
allowsOptOut?: boolean;
|
|
214
|
+
baseValue?: number;
|
|
215
|
+
tvaRating?: number;
|
|
216
|
+
tvaRanking?: number;
|
|
217
|
+
totalTVA?: number;
|
|
218
|
+
tgp?: number;
|
|
219
|
+
eventBoosterMultiplier?: number;
|
|
220
|
+
firstPlaceValue?: number;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Input for updating a tournament
|
|
224
|
+
*/
|
|
225
|
+
interface UpdateTournamentInput {
|
|
226
|
+
name?: string;
|
|
227
|
+
location?: string;
|
|
228
|
+
date?: Date;
|
|
229
|
+
tgpConfig?: Prisma.InputJsonValue;
|
|
230
|
+
eventBooster?: EventBoosterType;
|
|
231
|
+
allowsOptOut?: boolean;
|
|
232
|
+
baseValue?: number;
|
|
233
|
+
tvaRating?: number;
|
|
234
|
+
tvaRanking?: number;
|
|
235
|
+
totalTVA?: number;
|
|
236
|
+
tgp?: number;
|
|
237
|
+
eventBoosterMultiplier?: number;
|
|
238
|
+
firstPlaceValue?: number;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Options for querying tournaments
|
|
242
|
+
*/
|
|
243
|
+
interface FindTournamentsOptions {
|
|
244
|
+
take?: number;
|
|
245
|
+
skip?: number;
|
|
246
|
+
orderBy?: Prisma.TournamentOrderByWithRelationInput;
|
|
247
|
+
where?: Prisma.TournamentWhereInput;
|
|
248
|
+
include?: Prisma.TournamentInclude;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Creates a new tournament
|
|
252
|
+
*/
|
|
253
|
+
declare function createTournament(data: CreateTournamentInput): Promise<Tournament>;
|
|
254
|
+
/**
|
|
255
|
+
* Finds a tournament by ID
|
|
256
|
+
*/
|
|
257
|
+
declare function findTournamentById(id: string, include?: Prisma.TournamentInclude): Promise<Tournament | null>;
|
|
258
|
+
/**
|
|
259
|
+
* Finds a tournament by external ID
|
|
260
|
+
*/
|
|
261
|
+
declare function findTournamentByExternalId(externalId: string, include?: Prisma.TournamentInclude): Promise<Tournament | null>;
|
|
262
|
+
/**
|
|
263
|
+
* Finds multiple tournaments with optional filters
|
|
264
|
+
*/
|
|
265
|
+
declare function findTournaments(options?: FindTournamentsOptions): Promise<Tournament[]>;
|
|
266
|
+
/**
|
|
267
|
+
* Gets recent tournaments
|
|
268
|
+
*/
|
|
269
|
+
declare function getRecentTournaments(limit?: number, include?: Prisma.TournamentInclude): Promise<Tournament[]>;
|
|
270
|
+
/**
|
|
271
|
+
* Gets tournaments by date range
|
|
272
|
+
*/
|
|
273
|
+
declare function getTournamentsByDateRange(startDate: Date, endDate: Date, options?: Omit<FindTournamentsOptions, 'where'>): Promise<Tournament[]>;
|
|
274
|
+
/**
|
|
275
|
+
* Gets tournaments by event booster type
|
|
276
|
+
*/
|
|
277
|
+
declare function getTournamentsByBoosterType(boosterType: EventBoosterType, options?: Omit<FindTournamentsOptions, 'where'>): Promise<Tournament[]>;
|
|
278
|
+
/**
|
|
279
|
+
* Gets major tournaments
|
|
280
|
+
*/
|
|
281
|
+
declare function getMajorTournaments(limit?: number): Promise<Tournament[]>;
|
|
282
|
+
/**
|
|
283
|
+
* Updates a tournament
|
|
284
|
+
*/
|
|
285
|
+
declare function updateTournament(id: string, data: UpdateTournamentInput): Promise<Tournament>;
|
|
286
|
+
/**
|
|
287
|
+
* Deletes a tournament and all its results
|
|
288
|
+
*/
|
|
289
|
+
declare function deleteTournament(id: string): Promise<Tournament>;
|
|
290
|
+
/**
|
|
291
|
+
* Counts total tournaments
|
|
292
|
+
*/
|
|
293
|
+
declare function countTournaments(where?: Prisma.TournamentWhereInput): Promise<number>;
|
|
294
|
+
/**
|
|
295
|
+
* Gets tournament with all results and player details
|
|
296
|
+
*/
|
|
297
|
+
declare function getTournamentWithResults(id: string): Promise<({
|
|
298
|
+
results: ({
|
|
299
|
+
player: {
|
|
300
|
+
name: string | null;
|
|
301
|
+
id: string;
|
|
302
|
+
createdAt: Date;
|
|
303
|
+
updatedAt: Date;
|
|
304
|
+
externalId: string | null;
|
|
305
|
+
email: string | null;
|
|
306
|
+
rating: number;
|
|
307
|
+
ratingDeviation: number;
|
|
308
|
+
ranking: number | null;
|
|
309
|
+
isRated: boolean;
|
|
310
|
+
eventCount: number;
|
|
311
|
+
lastRatingUpdate: Date;
|
|
312
|
+
lastEventDate: Date | null;
|
|
313
|
+
};
|
|
314
|
+
} & {
|
|
315
|
+
id: string;
|
|
316
|
+
createdAt: Date;
|
|
317
|
+
updatedAt: Date;
|
|
318
|
+
playerId: string;
|
|
319
|
+
tournamentId: string;
|
|
320
|
+
position: number;
|
|
321
|
+
optedOut: boolean;
|
|
322
|
+
linearPoints: number | null;
|
|
323
|
+
dynamicPoints: number | null;
|
|
324
|
+
totalPoints: number | null;
|
|
325
|
+
ageInDays: number | null;
|
|
326
|
+
decayMultiplier: number | null;
|
|
327
|
+
decayedPoints: number | null;
|
|
328
|
+
efficiency: number | null;
|
|
329
|
+
})[];
|
|
330
|
+
} & {
|
|
331
|
+
name: string;
|
|
332
|
+
id: string;
|
|
333
|
+
createdAt: Date;
|
|
334
|
+
updatedAt: Date;
|
|
335
|
+
externalId: string | null;
|
|
336
|
+
location: string | null;
|
|
337
|
+
date: Date;
|
|
338
|
+
tgpConfig: Prisma.JsonValue | null;
|
|
339
|
+
eventBooster: _prisma_client.$Enums.EventBoosterType;
|
|
340
|
+
allowsOptOut: boolean;
|
|
341
|
+
baseValue: number | null;
|
|
342
|
+
tvaRating: number | null;
|
|
343
|
+
tvaRanking: number | null;
|
|
344
|
+
totalTVA: number | null;
|
|
345
|
+
tgp: number | null;
|
|
346
|
+
eventBoosterMultiplier: number | null;
|
|
347
|
+
firstPlaceValue: number | null;
|
|
348
|
+
}) | null>;
|
|
349
|
+
/**
|
|
350
|
+
* Searches tournaments by name or location
|
|
351
|
+
*/
|
|
352
|
+
declare function searchTournaments(query: string, limit?: number): Promise<Tournament[]>;
|
|
353
|
+
/**
|
|
354
|
+
* Gets tournament statistics
|
|
355
|
+
*/
|
|
356
|
+
declare function getTournamentStats(id: string): Promise<{
|
|
357
|
+
tournament: {
|
|
358
|
+
results: ({
|
|
359
|
+
player: {
|
|
360
|
+
name: string | null;
|
|
361
|
+
id: string;
|
|
362
|
+
createdAt: Date;
|
|
363
|
+
updatedAt: Date;
|
|
364
|
+
externalId: string | null;
|
|
365
|
+
email: string | null;
|
|
366
|
+
rating: number;
|
|
367
|
+
ratingDeviation: number;
|
|
368
|
+
ranking: number | null;
|
|
369
|
+
isRated: boolean;
|
|
370
|
+
eventCount: number;
|
|
371
|
+
lastRatingUpdate: Date;
|
|
372
|
+
lastEventDate: Date | null;
|
|
373
|
+
};
|
|
374
|
+
} & {
|
|
375
|
+
id: string;
|
|
376
|
+
createdAt: Date;
|
|
377
|
+
updatedAt: Date;
|
|
378
|
+
playerId: string;
|
|
379
|
+
tournamentId: string;
|
|
380
|
+
position: number;
|
|
381
|
+
optedOut: boolean;
|
|
382
|
+
linearPoints: number | null;
|
|
383
|
+
dynamicPoints: number | null;
|
|
384
|
+
totalPoints: number | null;
|
|
385
|
+
ageInDays: number | null;
|
|
386
|
+
decayMultiplier: number | null;
|
|
387
|
+
decayedPoints: number | null;
|
|
388
|
+
efficiency: number | null;
|
|
389
|
+
})[];
|
|
390
|
+
} & {
|
|
391
|
+
name: string;
|
|
392
|
+
id: string;
|
|
393
|
+
createdAt: Date;
|
|
394
|
+
updatedAt: Date;
|
|
395
|
+
externalId: string | null;
|
|
396
|
+
location: string | null;
|
|
397
|
+
date: Date;
|
|
398
|
+
tgpConfig: Prisma.JsonValue | null;
|
|
399
|
+
eventBooster: _prisma_client.$Enums.EventBoosterType;
|
|
400
|
+
allowsOptOut: boolean;
|
|
401
|
+
baseValue: number | null;
|
|
402
|
+
tvaRating: number | null;
|
|
403
|
+
tvaRanking: number | null;
|
|
404
|
+
totalTVA: number | null;
|
|
405
|
+
tgp: number | null;
|
|
406
|
+
eventBoosterMultiplier: number | null;
|
|
407
|
+
firstPlaceValue: number | null;
|
|
408
|
+
};
|
|
409
|
+
playerCount: number;
|
|
410
|
+
averagePoints: number;
|
|
411
|
+
averageEfficiency: number;
|
|
412
|
+
highestPoints: number;
|
|
413
|
+
lowestPoints: number;
|
|
414
|
+
} | null>;
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Input for creating a tournament result
|
|
418
|
+
*/
|
|
419
|
+
interface CreateResultInput {
|
|
420
|
+
playerId: string;
|
|
421
|
+
tournamentId: string;
|
|
422
|
+
position: number;
|
|
423
|
+
optedOut?: boolean;
|
|
424
|
+
linearPoints?: number;
|
|
425
|
+
dynamicPoints?: number;
|
|
426
|
+
totalPoints?: number;
|
|
427
|
+
ageInDays?: number;
|
|
428
|
+
decayMultiplier?: number;
|
|
429
|
+
decayedPoints?: number;
|
|
430
|
+
efficiency?: number;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Input for updating a tournament result
|
|
434
|
+
*/
|
|
435
|
+
interface UpdateResultInput {
|
|
436
|
+
position?: number;
|
|
437
|
+
optedOut?: boolean;
|
|
438
|
+
linearPoints?: number;
|
|
439
|
+
dynamicPoints?: number;
|
|
440
|
+
totalPoints?: number;
|
|
441
|
+
ageInDays?: number;
|
|
442
|
+
decayMultiplier?: number;
|
|
443
|
+
decayedPoints?: number;
|
|
444
|
+
efficiency?: number;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Options for querying results
|
|
448
|
+
*/
|
|
449
|
+
interface FindResultsOptions {
|
|
450
|
+
take?: number;
|
|
451
|
+
skip?: number;
|
|
452
|
+
orderBy?: Prisma.TournamentResultOrderByWithRelationInput;
|
|
453
|
+
where?: Prisma.TournamentResultWhereInput;
|
|
454
|
+
include?: Prisma.TournamentResultInclude;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Creates a new tournament result
|
|
458
|
+
*/
|
|
459
|
+
declare function createResult(data: CreateResultInput): Promise<TournamentResult>;
|
|
460
|
+
/**
|
|
461
|
+
* Creates multiple tournament results at once
|
|
462
|
+
*/
|
|
463
|
+
declare function createManyResults(data: CreateResultInput[]): Promise<Prisma.BatchPayload>;
|
|
464
|
+
/**
|
|
465
|
+
* Finds a result by ID
|
|
466
|
+
*/
|
|
467
|
+
declare function findResultById(id: string, include?: Prisma.TournamentResultInclude): Promise<TournamentResult | null>;
|
|
468
|
+
/**
|
|
469
|
+
* Finds a result by player and tournament
|
|
470
|
+
*/
|
|
471
|
+
declare function findResultByPlayerAndTournament(playerId: string, tournamentId: string, include?: Prisma.TournamentResultInclude): Promise<TournamentResult | null>;
|
|
472
|
+
/**
|
|
473
|
+
* Finds multiple results with optional filters
|
|
474
|
+
*/
|
|
475
|
+
declare function findResults(options?: FindResultsOptions): Promise<TournamentResult[]>;
|
|
476
|
+
/**
|
|
477
|
+
* Gets all results for a specific player
|
|
478
|
+
*/
|
|
479
|
+
declare function getPlayerResults(playerId: string, options?: Omit<FindResultsOptions, 'where'>): Promise<TournamentResult[]>;
|
|
480
|
+
/**
|
|
481
|
+
* Gets all results for a specific tournament
|
|
482
|
+
*/
|
|
483
|
+
declare function getTournamentResults(tournamentId: string, options?: Omit<FindResultsOptions, 'where'>): Promise<TournamentResult[]>;
|
|
484
|
+
/**
|
|
485
|
+
* Gets top N finishes for a player
|
|
486
|
+
*/
|
|
487
|
+
declare function getPlayerTopFinishes(playerId: string, limit?: number): Promise<TournamentResult[]>;
|
|
488
|
+
/**
|
|
489
|
+
* Updates a tournament result
|
|
490
|
+
*/
|
|
491
|
+
declare function updateResult(id: string, data: UpdateResultInput): Promise<TournamentResult>;
|
|
492
|
+
/**
|
|
493
|
+
* Updates result points and decay information
|
|
494
|
+
*/
|
|
495
|
+
declare function updateResultPoints(id: string, linearPoints: number, dynamicPoints: number, totalPoints: number): Promise<TournamentResult>;
|
|
496
|
+
/**
|
|
497
|
+
* Deletes a tournament result
|
|
498
|
+
*/
|
|
499
|
+
declare function deleteResult(id: string): Promise<TournamentResult>;
|
|
500
|
+
/**
|
|
501
|
+
* Deletes all results for a tournament
|
|
502
|
+
*/
|
|
503
|
+
declare function deleteResultsByTournament(tournamentId: string): Promise<Prisma.BatchPayload>;
|
|
504
|
+
/**
|
|
505
|
+
* Counts total results
|
|
506
|
+
*/
|
|
507
|
+
declare function countResults(where?: Prisma.TournamentResultWhereInput): Promise<number>;
|
|
508
|
+
/**
|
|
509
|
+
* Gets player statistics across all tournaments
|
|
510
|
+
*/
|
|
511
|
+
declare function getPlayerStats(playerId: string): Promise<{
|
|
512
|
+
totalEvents: number;
|
|
513
|
+
totalPoints: number;
|
|
514
|
+
totalDecayedPoints: number;
|
|
515
|
+
averagePoints: number;
|
|
516
|
+
averagePosition: number;
|
|
517
|
+
averageFinish: number;
|
|
518
|
+
averageEfficiency: number;
|
|
519
|
+
firstPlaceFinishes: number;
|
|
520
|
+
topThreeFinishes: number;
|
|
521
|
+
bestFinish: number;
|
|
522
|
+
highestPoints: number;
|
|
523
|
+
} | null>;
|
|
524
|
+
/**
|
|
525
|
+
* Calculates and updates time decay for all results
|
|
526
|
+
* Based on OPPR time decay rules:
|
|
527
|
+
* - 0-1 years: 100%
|
|
528
|
+
* - 1-2 years: 75%
|
|
529
|
+
* - 2-3 years: 50%
|
|
530
|
+
* - 3+ years: 0%
|
|
531
|
+
*/
|
|
532
|
+
declare function recalculateTimeDecay(referenceDate?: Date): Promise<{
|
|
533
|
+
id: string;
|
|
534
|
+
createdAt: Date;
|
|
535
|
+
updatedAt: Date;
|
|
536
|
+
playerId: string;
|
|
537
|
+
tournamentId: string;
|
|
538
|
+
position: number;
|
|
539
|
+
optedOut: boolean;
|
|
540
|
+
linearPoints: number | null;
|
|
541
|
+
dynamicPoints: number | null;
|
|
542
|
+
totalPoints: number | null;
|
|
543
|
+
ageInDays: number | null;
|
|
544
|
+
decayMultiplier: number | null;
|
|
545
|
+
decayedPoints: number | null;
|
|
546
|
+
efficiency: number | null;
|
|
547
|
+
}[]>;
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* Re-export Prisma generated types
|
|
551
|
+
*/
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Player with full tournament results
|
|
555
|
+
*/
|
|
556
|
+
interface PlayerWithResults {
|
|
557
|
+
player: Player;
|
|
558
|
+
results: TournamentResultWithTournament[];
|
|
559
|
+
stats: PlayerStatistics;
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Tournament result with tournament details
|
|
563
|
+
*/
|
|
564
|
+
interface TournamentResultWithTournament {
|
|
565
|
+
id: string;
|
|
566
|
+
position: number;
|
|
567
|
+
totalPoints: number;
|
|
568
|
+
decayedPoints: number;
|
|
569
|
+
tournament: {
|
|
570
|
+
id: string;
|
|
571
|
+
name: string;
|
|
572
|
+
date: Date;
|
|
573
|
+
eventBooster: EventBoosterType;
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Player statistics
|
|
578
|
+
*/
|
|
579
|
+
interface PlayerStatistics {
|
|
580
|
+
totalEvents: number;
|
|
581
|
+
totalPoints: number;
|
|
582
|
+
totalDecayedPoints: number;
|
|
583
|
+
averagePosition: number;
|
|
584
|
+
averageEfficiency: number;
|
|
585
|
+
firstPlaceFinishes: number;
|
|
586
|
+
topThreeFinishes: number;
|
|
587
|
+
bestFinish: number;
|
|
588
|
+
highestPoints: number;
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Tournament statistics
|
|
592
|
+
*/
|
|
593
|
+
interface TournamentStatistics {
|
|
594
|
+
totalPlayers: number;
|
|
595
|
+
totalPoints: number;
|
|
596
|
+
averagePosition: number;
|
|
597
|
+
highestPoints: number;
|
|
598
|
+
lowestPoints: number;
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Database connection status
|
|
602
|
+
*/
|
|
603
|
+
interface ConnectionStatus {
|
|
604
|
+
connected: boolean;
|
|
605
|
+
error?: string;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
export { type ConnectionStatus, type CreatePlayerInput, type CreateResultInput, type CreateTournamentInput, type FindPlayersOptions, type FindResultsOptions, type FindTournamentsOptions, type PlayerStatistics, type PlayerWithResults, type TournamentResultWithTournament, type TournamentStatistics, type UpdatePlayerInput, type UpdateResultInput, type UpdateTournamentInput, connect, countPlayers, countResults, countTournaments, createManyResults, createPlayer, createResult, createTournament, deletePlayer, deleteResult, deleteResultsByTournament, deleteTournament, disconnect, findPlayerByEmail, findPlayerByExternalId, findPlayerById, findPlayers, findResultById, findResultByPlayerAndTournament, findResults, findTournamentByExternalId, findTournamentById, findTournaments, getMajorTournaments, getPlayerResults, getPlayerStats, getPlayerTopFinishes, getPlayerWithResults, getRatedPlayers, getRecentTournaments, getTopPlayersByRanking, getTopPlayersByRating, getTournamentResults, getTournamentStats, getTournamentWithResults, getTournamentsByBoosterType, getTournamentsByDateRange, prisma, recalculateTimeDecay, searchPlayers, searchTournaments, testConnection, updatePlayer, updatePlayerRating, updateResult, updateResultPoints, updateTournament };
|