@opprs/db-prisma 2.2.1-canary.840995 → 2.2.1-canary.93558b4

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.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, TournamentResult, User } from '@prisma/client';
4
- export { EventBoosterType, Player, Prisma, Role, Tournament, TournamentResult, User } from '@prisma/client';
3
+ import { PrismaClient, Player, Prisma, OpprPlayerRanking, OpprRankingChangeType, OpprRankingHistory, EventBoosterType, Tournament, Round, Match, MatchResult, Entry, Standing, User, ApiKey, Location, PostStatus, BlogPost, BlogTag } 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 results
88
+ * Gets player with their tournament standings
113
89
  */
114
90
  declare function getPlayerWithResults(id: string): Promise<{
115
91
  results: ({
@@ -119,8 +95,11 @@ declare function getPlayerWithResults(id: string): Promise<{
119
95
  createdAt: Date;
120
96
  updatedAt: Date;
121
97
  externalId: string | null;
122
- location: string | null;
98
+ externalUrl: string | null;
99
+ description: string | null;
123
100
  date: Date;
101
+ locationId: string | null;
102
+ organizerId: string | null;
124
103
  tgpConfig: Prisma.JsonValue | null;
125
104
  eventBooster: _prisma_client.$Enums.EventBoosterType;
126
105
  allowsOptOut: boolean;
@@ -136,9 +115,10 @@ declare function getPlayerWithResults(id: string): Promise<{
136
115
  id: string;
137
116
  createdAt: Date;
138
117
  updatedAt: Date;
139
- playerId: string;
140
118
  tournamentId: string;
119
+ playerId: string;
141
120
  position: number;
121
+ isFinals: boolean;
142
122
  optedOut: boolean;
143
123
  linearPoints: number | null;
144
124
  dynamicPoints: number | null;
@@ -148,15 +128,18 @@ declare function getPlayerWithResults(id: string): Promise<{
148
128
  decayedPoints: number | null;
149
129
  efficiency: number | null;
150
130
  })[];
151
- tournamentResults: ({
131
+ standings: ({
152
132
  tournament: {
153
133
  name: string;
154
134
  id: string;
155
135
  createdAt: Date;
156
136
  updatedAt: Date;
157
137
  externalId: string | null;
158
- location: string | null;
138
+ externalUrl: string | null;
139
+ description: string | null;
159
140
  date: Date;
141
+ locationId: string | null;
142
+ organizerId: string | null;
160
143
  tgpConfig: Prisma.JsonValue | null;
161
144
  eventBooster: _prisma_client.$Enums.EventBoosterType;
162
145
  allowsOptOut: boolean;
@@ -172,9 +155,10 @@ declare function getPlayerWithResults(id: string): Promise<{
172
155
  id: string;
173
156
  createdAt: Date;
174
157
  updatedAt: Date;
175
- playerId: string;
176
158
  tournamentId: string;
159
+ playerId: string;
177
160
  position: number;
161
+ isFinals: boolean;
178
162
  optedOut: boolean;
179
163
  linearPoints: number | null;
180
164
  dynamicPoints: number | null;
@@ -190,12 +174,7 @@ declare function getPlayerWithResults(id: string): Promise<{
190
174
  updatedAt: Date;
191
175
  externalId: string | null;
192
176
  playerNumber: number;
193
- rating: number;
194
- ratingDeviation: number;
195
- ranking: number | null;
196
- isRated: boolean;
197
177
  eventCount: number;
198
- lastRatingUpdate: Date;
199
178
  lastEventDate: Date | null;
200
179
  } | null>;
201
180
  /**
@@ -203,6 +182,129 @@ declare function getPlayerWithResults(id: string): Promise<{
203
182
  */
204
183
  declare function searchPlayers(query: string, limit?: number): Promise<Player[]>;
205
184
 
185
+ /**
186
+ * Input for creating a new OPPR player ranking
187
+ */
188
+ interface CreateOpprPlayerRankingInput {
189
+ playerId: string;
190
+ rating?: number;
191
+ ratingDeviation?: number;
192
+ ranking?: number;
193
+ isRated?: boolean;
194
+ }
195
+ /**
196
+ * Input for updating an OPPR player ranking
197
+ */
198
+ interface UpdateOpprPlayerRankingInput {
199
+ rating?: number;
200
+ ratingDeviation?: number;
201
+ ranking?: number;
202
+ isRated?: boolean;
203
+ lastRatingUpdate?: Date;
204
+ }
205
+ /**
206
+ * Options for querying OPPR rankings
207
+ */
208
+ interface FindOpprPlayerRankingsOptions {
209
+ take?: number;
210
+ skip?: number;
211
+ orderBy?: Prisma.OpprPlayerRankingOrderByWithRelationInput;
212
+ where?: Prisma.OpprPlayerRankingWhereInput;
213
+ include?: Prisma.OpprPlayerRankingInclude;
214
+ }
215
+ /**
216
+ * Input for creating a ranking history record
217
+ */
218
+ interface CreateOpprRankingHistoryInput {
219
+ opprPlayerRankingId: string;
220
+ rating: number;
221
+ ratingDeviation: number;
222
+ ranking?: number;
223
+ isRated: boolean;
224
+ changeType: OpprRankingChangeType;
225
+ tournamentId?: string;
226
+ notes?: string;
227
+ }
228
+ /**
229
+ * Gets or creates an OPPR player ranking for a player
230
+ */
231
+ declare function getOrCreateOpprPlayerRanking(playerId: string): Promise<OpprPlayerRanking>;
232
+ /**
233
+ * Creates a new OPPR player ranking
234
+ */
235
+ declare function createOpprPlayerRanking(data: CreateOpprPlayerRankingInput): Promise<OpprPlayerRanking>;
236
+ /**
237
+ * Finds OPPR ranking by ID
238
+ */
239
+ declare function findOpprPlayerRankingById(id: string, include?: Prisma.OpprPlayerRankingInclude): Promise<OpprPlayerRanking | null>;
240
+ /**
241
+ * Finds OPPR ranking by player ID
242
+ */
243
+ declare function findOpprPlayerRankingByPlayerId(playerId: string, include?: Prisma.OpprPlayerRankingInclude): Promise<OpprPlayerRanking | null>;
244
+ /**
245
+ * Finds multiple OPPR rankings with optional filters
246
+ */
247
+ declare function findOpprPlayerRankings(options?: FindOpprPlayerRankingsOptions): Promise<OpprPlayerRanking[]>;
248
+ /**
249
+ * Gets all rated players ordered by rating (highest first)
250
+ */
251
+ declare function getTopPlayersByOpprRating(limit?: number): Promise<OpprPlayerRanking[]>;
252
+ /**
253
+ * Gets all ranked players ordered by world ranking (best first)
254
+ */
255
+ declare function getTopPlayersByOpprRanking(limit?: number): Promise<OpprPlayerRanking[]>;
256
+ /**
257
+ * Gets all rated players
258
+ */
259
+ declare function getRatedOpprPlayers(options?: Omit<FindOpprPlayerRankingsOptions, 'where'>): Promise<OpprPlayerRanking[]>;
260
+ /**
261
+ * Updates OPPR player ranking
262
+ */
263
+ declare function updateOpprPlayerRanking(playerId: string, data: UpdateOpprPlayerRankingInput): Promise<OpprPlayerRanking>;
264
+ /**
265
+ * Updates rating after a tournament and creates history record
266
+ */
267
+ declare function updateOpprRatingAfterTournament(playerId: string, newRating: number, newRD: number, tournamentId: string, eventCount?: number): Promise<OpprPlayerRanking>;
268
+ /**
269
+ * Updates world rankings for all players (batch operation)
270
+ */
271
+ declare function updateWorldRankings(rankings: Array<{
272
+ playerId: string;
273
+ ranking: number;
274
+ }>): Promise<void>;
275
+ /**
276
+ * Applies RD decay for inactive players
277
+ */
278
+ declare function applyRDDecayForInactivePlayers(thresholdDays?: number, decayPerDay?: number, maxRD?: number): Promise<number>;
279
+ /**
280
+ * Deletes OPPR player ranking (cascades to history)
281
+ */
282
+ declare function deleteOpprPlayerRanking(playerId: string): Promise<OpprPlayerRanking>;
283
+ /**
284
+ * Counts OPPR rankings
285
+ */
286
+ declare function countOpprPlayerRankings(where?: Prisma.OpprPlayerRankingWhereInput): Promise<number>;
287
+ /**
288
+ * Creates a ranking history record
289
+ */
290
+ declare function createOpprRankingHistory(data: CreateOpprRankingHistoryInput): Promise<OpprRankingHistory>;
291
+ /**
292
+ * Gets ranking history for a player
293
+ */
294
+ declare function getOpprRankingHistory(playerId: string, limit?: number): Promise<OpprRankingHistory[]>;
295
+ /**
296
+ * Gets ranking history for a specific time period
297
+ */
298
+ declare function getOpprRankingHistoryByDateRange(playerId: string, startDate: Date, endDate: Date): Promise<OpprRankingHistory[]>;
299
+ /**
300
+ * Gets the most recent history record for a player
301
+ */
302
+ declare function getLatestOpprRankingHistory(playerId: string): Promise<OpprRankingHistory | null>;
303
+ /**
304
+ * Counts ranking history records
305
+ */
306
+ declare function countOpprRankingHistory(where?: Prisma.OpprRankingHistoryWhereInput): Promise<number>;
307
+
206
308
  /**
207
309
  * Generates a unique player number with collision handling.
208
310
  * Retries up to MAX_RETRIES times if collision occurs.
@@ -220,9 +322,12 @@ declare function isValidPlayerNumber(playerNumber: number): boolean;
220
322
  */
221
323
  interface CreateTournamentInput {
222
324
  externalId?: string;
325
+ externalUrl?: string;
223
326
  name: string;
224
- location?: string;
327
+ description?: string;
225
328
  date: Date;
329
+ locationId?: string;
330
+ organizerId?: string;
226
331
  tgpConfig?: Prisma.InputJsonValue;
227
332
  eventBooster?: EventBoosterType;
228
333
  allowsOptOut?: boolean;
@@ -238,9 +343,12 @@ interface CreateTournamentInput {
238
343
  * Input for updating a tournament
239
344
  */
240
345
  interface UpdateTournamentInput {
346
+ externalUrl?: string | null;
241
347
  name?: string;
242
- location?: string;
348
+ description?: string | null;
243
349
  date?: Date;
350
+ locationId?: string | null;
351
+ organizerId?: string | null;
244
352
  tgpConfig?: Prisma.InputJsonValue;
245
353
  eventBooster?: EventBoosterType;
246
354
  allowsOptOut?: boolean;
@@ -307,10 +415,10 @@ declare function deleteTournament(id: string): Promise<Tournament>;
307
415
  */
308
416
  declare function countTournaments(where?: Prisma.TournamentWhereInput): Promise<number>;
309
417
  /**
310
- * Gets tournament with all results and player details
418
+ * Gets tournament with all standings and player details
311
419
  */
312
420
  declare function getTournamentWithResults(id: string): Promise<({
313
- results: ({
421
+ standings: ({
314
422
  player: {
315
423
  name: string | null;
316
424
  id: string;
@@ -318,21 +426,17 @@ declare function getTournamentWithResults(id: string): Promise<({
318
426
  updatedAt: Date;
319
427
  externalId: string | null;
320
428
  playerNumber: number;
321
- rating: number;
322
- ratingDeviation: number;
323
- ranking: number | null;
324
- isRated: boolean;
325
429
  eventCount: number;
326
- lastRatingUpdate: Date;
327
430
  lastEventDate: Date | null;
328
431
  };
329
432
  } & {
330
433
  id: string;
331
434
  createdAt: Date;
332
435
  updatedAt: Date;
333
- playerId: string;
334
436
  tournamentId: string;
437
+ playerId: string;
335
438
  position: number;
439
+ isFinals: boolean;
336
440
  optedOut: boolean;
337
441
  linearPoints: number | null;
338
442
  dynamicPoints: number | null;
@@ -348,8 +452,11 @@ declare function getTournamentWithResults(id: string): Promise<({
348
452
  createdAt: Date;
349
453
  updatedAt: Date;
350
454
  externalId: string | null;
351
- location: string | null;
455
+ externalUrl: string | null;
456
+ description: string | null;
352
457
  date: Date;
458
+ locationId: string | null;
459
+ organizerId: string | null;
353
460
  tgpConfig: Prisma.JsonValue | null;
354
461
  eventBooster: _prisma_client.$Enums.EventBoosterType;
355
462
  allowsOptOut: boolean;
@@ -362,7 +469,73 @@ declare function getTournamentWithResults(id: string): Promise<({
362
469
  firstPlaceValue: number | null;
363
470
  }) | null>;
364
471
  /**
365
- * Searches tournaments by name or location
472
+ * Gets tournament with rounds, matches, and entries
473
+ */
474
+ declare function getTournamentWithMatches(id: string): Promise<({
475
+ rounds: ({
476
+ matches: ({
477
+ entries: ({
478
+ player: {
479
+ name: string | null;
480
+ id: string;
481
+ createdAt: Date;
482
+ updatedAt: Date;
483
+ externalId: string | null;
484
+ playerNumber: number;
485
+ eventCount: number;
486
+ lastEventDate: Date | null;
487
+ };
488
+ } & {
489
+ result: _prisma_client.$Enums.MatchResult;
490
+ id: string;
491
+ createdAt: Date;
492
+ updatedAt: Date;
493
+ playerId: string;
494
+ position: number | null;
495
+ matchId: string;
496
+ })[];
497
+ } & {
498
+ number: number | null;
499
+ id: string;
500
+ createdAt: Date;
501
+ updatedAt: Date;
502
+ tournamentId: string;
503
+ roundId: string | null;
504
+ machineName: string | null;
505
+ })[];
506
+ } & {
507
+ number: number;
508
+ name: string | null;
509
+ id: string;
510
+ createdAt: Date;
511
+ updatedAt: Date;
512
+ tournamentId: string;
513
+ isFinals: boolean;
514
+ })[];
515
+ } & {
516
+ name: string;
517
+ id: string;
518
+ createdAt: Date;
519
+ updatedAt: Date;
520
+ externalId: string | null;
521
+ externalUrl: string | null;
522
+ description: string | null;
523
+ date: Date;
524
+ locationId: string | null;
525
+ organizerId: string | null;
526
+ tgpConfig: Prisma.JsonValue | null;
527
+ eventBooster: _prisma_client.$Enums.EventBoosterType;
528
+ allowsOptOut: boolean;
529
+ baseValue: number | null;
530
+ tvaRating: number | null;
531
+ tvaRanking: number | null;
532
+ totalTVA: number | null;
533
+ tgp: number | null;
534
+ eventBoosterMultiplier: number | null;
535
+ firstPlaceValue: number | null;
536
+ }) | null>;
537
+ /**
538
+ * Searches tournaments by name or location name
366
539
  */
367
540
  declare function searchTournaments(query: string, limit?: number): Promise<Tournament[]>;
368
541
  /**
@@ -370,7 +543,7 @@ declare function searchTournaments(query: string, limit?: number): Promise<Tourn
370
543
  */
371
544
  declare function getTournamentStats(id: string): Promise<{
372
545
  tournament: {
373
- results: ({
546
+ standings: ({
374
547
  player: {
375
548
  name: string | null;
376
549
  id: string;
@@ -378,21 +551,17 @@ declare function getTournamentStats(id: string): Promise<{
378
551
  updatedAt: Date;
379
552
  externalId: string | null;
380
553
  playerNumber: number;
381
- rating: number;
382
- ratingDeviation: number;
383
- ranking: number | null;
384
- isRated: boolean;
385
554
  eventCount: number;
386
- lastRatingUpdate: Date;
387
555
  lastEventDate: Date | null;
388
556
  };
389
557
  } & {
390
558
  id: string;
391
559
  createdAt: Date;
392
560
  updatedAt: Date;
393
- playerId: string;
394
561
  tournamentId: string;
562
+ playerId: string;
395
563
  position: number;
564
+ isFinals: boolean;
396
565
  optedOut: boolean;
397
566
  linearPoints: number | null;
398
567
  dynamicPoints: number | null;
@@ -408,8 +577,11 @@ declare function getTournamentStats(id: string): Promise<{
408
577
  createdAt: Date;
409
578
  updatedAt: Date;
410
579
  externalId: string | null;
411
- location: string | null;
580
+ externalUrl: string | null;
581
+ description: string | null;
412
582
  date: Date;
583
+ locationId: string | null;
584
+ organizerId: string | null;
413
585
  tgpConfig: Prisma.JsonValue | null;
414
586
  eventBooster: _prisma_client.$Enums.EventBoosterType;
415
587
  allowsOptOut: boolean;
@@ -429,12 +601,342 @@ declare function getTournamentStats(id: string): Promise<{
429
601
  } | null>;
430
602
 
431
603
  /**
432
- * Input for creating a tournament result
604
+ * Input for creating a new round
605
+ */
606
+ interface CreateRoundInput {
607
+ tournamentId: string;
608
+ number: number;
609
+ name?: string;
610
+ isFinals?: boolean;
611
+ }
612
+ /**
613
+ * Input for updating a round
614
+ */
615
+ interface UpdateRoundInput {
616
+ number?: number;
617
+ name?: string;
618
+ isFinals?: boolean;
619
+ }
620
+ /**
621
+ * Options for querying rounds
433
622
  */
434
- interface CreateResultInput {
623
+ interface FindRoundsOptions {
624
+ take?: number;
625
+ skip?: number;
626
+ orderBy?: Prisma.RoundOrderByWithRelationInput | Prisma.RoundOrderByWithRelationInput[];
627
+ where?: Prisma.RoundWhereInput;
628
+ include?: Prisma.RoundInclude;
629
+ }
630
+ /**
631
+ * Creates a new round
632
+ */
633
+ declare function createRound(data: CreateRoundInput): Promise<Round>;
634
+ /**
635
+ * Creates multiple rounds at once
636
+ */
637
+ declare function createManyRounds(data: CreateRoundInput[]): Promise<Prisma.BatchPayload>;
638
+ /**
639
+ * Finds a round by ID
640
+ */
641
+ declare function findRoundById(id: string, include?: Prisma.RoundInclude): Promise<Round | null>;
642
+ /**
643
+ * Finds a round by tournament, number, and isFinals
644
+ */
645
+ declare function findRoundByTournamentAndNumber(tournamentId: string, number: number, isFinals: boolean, include?: Prisma.RoundInclude): Promise<Round | null>;
646
+ /**
647
+ * Finds multiple rounds with optional filters
648
+ */
649
+ declare function findRounds(options?: FindRoundsOptions): Promise<Round[]>;
650
+ /**
651
+ * Gets all rounds for a specific tournament
652
+ */
653
+ declare function getTournamentRounds(tournamentId: string, options?: Omit<FindRoundsOptions, 'where'>): Promise<Round[]>;
654
+ /**
655
+ * Gets qualifying rounds for a tournament
656
+ */
657
+ declare function getQualifyingRounds(tournamentId: string, options?: Omit<FindRoundsOptions, 'where'>): Promise<Round[]>;
658
+ /**
659
+ * Gets finals rounds for a tournament
660
+ */
661
+ declare function getFinalsRounds(tournamentId: string, options?: Omit<FindRoundsOptions, 'where'>): Promise<Round[]>;
662
+ /**
663
+ * Updates a round
664
+ */
665
+ declare function updateRound(id: string, data: UpdateRoundInput): Promise<Round>;
666
+ /**
667
+ * Deletes a round
668
+ */
669
+ declare function deleteRound(id: string): Promise<Round>;
670
+ /**
671
+ * Deletes all rounds for a tournament
672
+ */
673
+ declare function deleteRoundsByTournament(tournamentId: string): Promise<Prisma.BatchPayload>;
674
+ /**
675
+ * Counts total rounds
676
+ */
677
+ declare function countRounds(where?: Prisma.RoundWhereInput): Promise<number>;
678
+ /**
679
+ * Gets a round with all its matches
680
+ */
681
+ declare function getRoundWithMatches(id: string): Promise<({
682
+ matches: ({
683
+ entries: ({
684
+ player: {
685
+ name: string | null;
686
+ id: string;
687
+ createdAt: Date;
688
+ updatedAt: Date;
689
+ externalId: string | null;
690
+ playerNumber: number;
691
+ eventCount: number;
692
+ lastEventDate: Date | null;
693
+ };
694
+ } & {
695
+ result: _prisma_client.$Enums.MatchResult;
696
+ id: string;
697
+ createdAt: Date;
698
+ updatedAt: Date;
699
+ playerId: string;
700
+ position: number | null;
701
+ matchId: string;
702
+ })[];
703
+ } & {
704
+ number: number | null;
705
+ id: string;
706
+ createdAt: Date;
707
+ updatedAt: Date;
708
+ tournamentId: string;
709
+ roundId: string | null;
710
+ machineName: string | null;
711
+ })[];
712
+ } & {
713
+ number: number;
714
+ name: string | null;
715
+ id: string;
716
+ createdAt: Date;
717
+ updatedAt: Date;
718
+ tournamentId: string;
719
+ isFinals: boolean;
720
+ }) | null>;
721
+
722
+ /**
723
+ * Input for creating a new match
724
+ */
725
+ interface CreateMatchInput {
726
+ tournamentId: string;
727
+ roundId?: string;
728
+ number?: number;
729
+ machineName?: string;
730
+ }
731
+ /**
732
+ * Input for updating a match
733
+ */
734
+ interface UpdateMatchInput {
735
+ roundId?: string | null;
736
+ number?: number;
737
+ machineName?: string;
738
+ }
739
+ /**
740
+ * Options for querying matches
741
+ */
742
+ interface FindMatchesOptions {
743
+ take?: number;
744
+ skip?: number;
745
+ orderBy?: Prisma.MatchOrderByWithRelationInput | Prisma.MatchOrderByWithRelationInput[];
746
+ where?: Prisma.MatchWhereInput;
747
+ include?: Prisma.MatchInclude;
748
+ }
749
+ /**
750
+ * Creates a new match
751
+ */
752
+ declare function createMatch(data: CreateMatchInput): Promise<Match>;
753
+ /**
754
+ * Creates multiple matches at once
755
+ */
756
+ declare function createManyMatches(data: CreateMatchInput[]): Promise<Prisma.BatchPayload>;
757
+ /**
758
+ * Finds a match by ID
759
+ */
760
+ declare function findMatchById(id: string, include?: Prisma.MatchInclude): Promise<Match | null>;
761
+ /**
762
+ * Finds multiple matches with optional filters
763
+ */
764
+ declare function findMatches(options?: FindMatchesOptions): Promise<Match[]>;
765
+ /**
766
+ * Gets all matches for a specific tournament
767
+ */
768
+ declare function getTournamentMatches(tournamentId: string, options?: Omit<FindMatchesOptions, 'where'>): Promise<Match[]>;
769
+ /**
770
+ * Gets all matches for a specific round
771
+ */
772
+ declare function getRoundMatches(roundId: string, options?: Omit<FindMatchesOptions, 'where'>): Promise<Match[]>;
773
+ /**
774
+ * Updates a match
775
+ */
776
+ declare function updateMatch(id: string, data: UpdateMatchInput): Promise<Match>;
777
+ /**
778
+ * Deletes a match
779
+ */
780
+ declare function deleteMatch(id: string): Promise<Match>;
781
+ /**
782
+ * Deletes all matches for a tournament
783
+ */
784
+ declare function deleteMatchesByTournament(tournamentId: string): Promise<Prisma.BatchPayload>;
785
+ /**
786
+ * Deletes all matches for a round
787
+ */
788
+ declare function deleteMatchesByRound(roundId: string): Promise<Prisma.BatchPayload>;
789
+ /**
790
+ * Counts total matches
791
+ */
792
+ declare function countMatches(where?: Prisma.MatchWhereInput): Promise<number>;
793
+ /**
794
+ * Gets a match with all its entries and player details
795
+ */
796
+ declare function getMatchWithEntries(id: string): Promise<({
797
+ round: {
798
+ number: number;
799
+ name: string | null;
800
+ id: string;
801
+ createdAt: Date;
802
+ updatedAt: Date;
803
+ tournamentId: string;
804
+ isFinals: boolean;
805
+ } | null;
806
+ entries: ({
807
+ player: {
808
+ name: string | null;
809
+ id: string;
810
+ createdAt: Date;
811
+ updatedAt: Date;
812
+ externalId: string | null;
813
+ playerNumber: number;
814
+ eventCount: number;
815
+ lastEventDate: Date | null;
816
+ };
817
+ } & {
818
+ result: _prisma_client.$Enums.MatchResult;
819
+ id: string;
820
+ createdAt: Date;
821
+ updatedAt: Date;
822
+ playerId: string;
823
+ position: number | null;
824
+ matchId: string;
825
+ })[];
826
+ } & {
827
+ number: number | null;
828
+ id: string;
829
+ createdAt: Date;
830
+ updatedAt: Date;
831
+ tournamentId: string;
832
+ roundId: string | null;
833
+ machineName: string | null;
834
+ }) | null>;
835
+ /**
836
+ * Gets matches for a player in a tournament
837
+ */
838
+ declare function getPlayerTournamentMatches(playerId: string, tournamentId: string, include?: Prisma.MatchInclude): Promise<Match[]>;
839
+
840
+ /**
841
+ * Input for creating a new entry
842
+ */
843
+ interface CreateEntryInput {
844
+ matchId: string;
435
845
  playerId: string;
846
+ result: MatchResult;
847
+ position?: number;
848
+ }
849
+ /**
850
+ * Input for updating an entry
851
+ */
852
+ interface UpdateEntryInput {
853
+ result?: MatchResult;
854
+ position?: number;
855
+ }
856
+ /**
857
+ * Options for querying entries
858
+ */
859
+ interface FindEntriesOptions {
860
+ take?: number;
861
+ skip?: number;
862
+ orderBy?: Prisma.EntryOrderByWithRelationInput;
863
+ where?: Prisma.EntryWhereInput;
864
+ include?: Prisma.EntryInclude;
865
+ }
866
+ /**
867
+ * Creates a new entry
868
+ */
869
+ declare function createEntry(data: CreateEntryInput): Promise<Entry>;
870
+ /**
871
+ * Creates multiple entries at once
872
+ */
873
+ declare function createManyEntries(data: CreateEntryInput[]): Promise<Prisma.BatchPayload>;
874
+ /**
875
+ * Finds an entry by ID
876
+ */
877
+ declare function findEntryById(id: string, include?: Prisma.EntryInclude): Promise<Entry | null>;
878
+ /**
879
+ * Finds an entry by match and player
880
+ */
881
+ declare function findEntryByMatchAndPlayer(matchId: string, playerId: string, include?: Prisma.EntryInclude): Promise<Entry | null>;
882
+ /**
883
+ * Finds multiple entries with optional filters
884
+ */
885
+ declare function findEntries(options?: FindEntriesOptions): Promise<Entry[]>;
886
+ /**
887
+ * Gets all entries for a specific match
888
+ */
889
+ declare function getMatchEntries(matchId: string, options?: Omit<FindEntriesOptions, 'where'>): Promise<Entry[]>;
890
+ /**
891
+ * Gets all entries for a specific player
892
+ */
893
+ declare function getPlayerEntries(playerId: string, options?: Omit<FindEntriesOptions, 'where'>): Promise<Entry[]>;
894
+ /**
895
+ * Gets player entries in a tournament
896
+ */
897
+ declare function getPlayerTournamentEntries(playerId: string, tournamentId: string, include?: Prisma.EntryInclude): Promise<Entry[]>;
898
+ /**
899
+ * Updates an entry
900
+ */
901
+ declare function updateEntry(id: string, data: UpdateEntryInput): Promise<Entry>;
902
+ /**
903
+ * Deletes an entry
904
+ */
905
+ declare function deleteEntry(id: string): Promise<Entry>;
906
+ /**
907
+ * Deletes all entries for a match
908
+ */
909
+ declare function deleteEntriesByMatch(matchId: string): Promise<Prisma.BatchPayload>;
910
+ /**
911
+ * Counts total entries
912
+ */
913
+ declare function countEntries(where?: Prisma.EntryWhereInput): Promise<number>;
914
+ /**
915
+ * Gets player statistics from entries
916
+ */
917
+ declare function getPlayerEntryStats(playerId: string): Promise<{
918
+ totalMatches: number;
919
+ wins: number;
920
+ losses: number;
921
+ ties: number;
922
+ winRate: number;
923
+ } | null>;
924
+
925
+ /**
926
+ * Merged standing with calculated position for points
927
+ */
928
+ interface MergedStanding extends Standing {
929
+ mergedPosition: number;
930
+ isFinalist: boolean;
931
+ }
932
+ /**
933
+ * Input for creating a new standing
934
+ */
935
+ interface CreateStandingInput {
436
936
  tournamentId: string;
937
+ playerId: string;
437
938
  position: number;
939
+ isFinals?: boolean;
438
940
  optedOut?: boolean;
439
941
  linearPoints?: number;
440
942
  dynamicPoints?: number;
@@ -445,9 +947,9 @@ interface CreateResultInput {
445
947
  efficiency?: number;
446
948
  }
447
949
  /**
448
- * Input for updating a tournament result
950
+ * Input for updating a standing
449
951
  */
450
- interface UpdateResultInput {
952
+ interface UpdateStandingInput {
451
953
  position?: number;
452
954
  optedOut?: boolean;
453
955
  linearPoints?: number;
@@ -459,67 +961,80 @@ interface UpdateResultInput {
459
961
  efficiency?: number;
460
962
  }
461
963
  /**
462
- * Options for querying results
964
+ * Options for querying standings
463
965
  */
464
- interface FindResultsOptions {
966
+ interface FindStandingsOptions {
465
967
  take?: number;
466
968
  skip?: number;
467
- orderBy?: Prisma.TournamentResultOrderByWithRelationInput;
468
- where?: Prisma.TournamentResultWhereInput;
469
- include?: Prisma.TournamentResultInclude;
969
+ orderBy?: Prisma.StandingOrderByWithRelationInput;
970
+ where?: Prisma.StandingWhereInput;
971
+ include?: Prisma.StandingInclude;
470
972
  }
471
973
  /**
472
- * Creates a new tournament result
974
+ * Creates a new standing
975
+ */
976
+ declare function createStanding(data: CreateStandingInput): Promise<Standing>;
977
+ /**
978
+ * Creates multiple standings at once
979
+ */
980
+ declare function createManyStandings(data: CreateStandingInput[]): Promise<Prisma.BatchPayload>;
981
+ /**
982
+ * Finds a standing by ID
983
+ */
984
+ declare function findStandingById(id: string, include?: Prisma.StandingInclude): Promise<Standing | null>;
985
+ /**
986
+ * Finds a standing by player, tournament, and isFinals
473
987
  */
474
- declare function createResult(data: CreateResultInput): Promise<TournamentResult>;
988
+ declare function findStandingByPlayerAndTournament(playerId: string, tournamentId: string, isFinals: boolean, include?: Prisma.StandingInclude): Promise<Standing | null>;
475
989
  /**
476
- * Creates multiple tournament results at once
990
+ * Finds multiple standings with optional filters
477
991
  */
478
- declare function createManyResults(data: CreateResultInput[]): Promise<Prisma.BatchPayload>;
992
+ declare function findStandings(options?: FindStandingsOptions): Promise<Standing[]>;
479
993
  /**
480
- * Finds a result by ID
994
+ * Gets all standings for a specific player
481
995
  */
482
- declare function findResultById(id: string, include?: Prisma.TournamentResultInclude): Promise<TournamentResult | null>;
996
+ declare function getPlayerStandings(playerId: string, options?: Omit<FindStandingsOptions, 'where'>): Promise<Standing[]>;
483
997
  /**
484
- * Finds a result by player and tournament
998
+ * Gets all standings for a specific tournament
485
999
  */
486
- declare function findResultByPlayerAndTournament(playerId: string, tournamentId: string, include?: Prisma.TournamentResultInclude): Promise<TournamentResult | null>;
1000
+ declare function getTournamentStandings(tournamentId: string, options?: Omit<FindStandingsOptions, 'where'>): Promise<Standing[]>;
487
1001
  /**
488
- * Finds multiple results with optional filters
1002
+ * Gets qualifying standings for a tournament
489
1003
  */
490
- declare function findResults(options?: FindResultsOptions): Promise<TournamentResult[]>;
1004
+ declare function getQualifyingStandings(tournamentId: string, options?: Omit<FindStandingsOptions, 'where'>): Promise<Standing[]>;
491
1005
  /**
492
- * Gets all results for a specific player
1006
+ * Gets finals standings for a tournament
493
1007
  */
494
- declare function getPlayerResults(playerId: string, options?: Omit<FindResultsOptions, 'where'>): Promise<TournamentResult[]>;
1008
+ declare function getFinalsStandings(tournamentId: string, options?: Omit<FindStandingsOptions, 'where'>): Promise<Standing[]>;
495
1009
  /**
496
- * Gets all results for a specific tournament
1010
+ * Gets merged standings for point calculation.
1011
+ * Finalists get their finals position, non-finalists get qualifying position + finalist count
497
1012
  */
498
- declare function getTournamentResults(tournamentId: string, options?: Omit<FindResultsOptions, 'where'>): Promise<TournamentResult[]>;
1013
+ declare function getMergedStandings(tournamentId: string): Promise<MergedStanding[]>;
499
1014
  /**
500
1015
  * Gets top N finishes for a player
501
1016
  */
502
- declare function getPlayerTopFinishes(playerId: string, limit?: number): Promise<TournamentResult[]>;
1017
+ declare function getPlayerTopFinishes(playerId: string, limit?: number): Promise<Standing[]>;
503
1018
  /**
504
- * Updates a tournament result
1019
+ * Updates a standing
505
1020
  */
506
- declare function updateResult(id: string, data: UpdateResultInput): Promise<TournamentResult>;
1021
+ declare function updateStanding(id: string, data: UpdateStandingInput): Promise<Standing>;
507
1022
  /**
508
- * Updates result points and decay information
1023
+ * Updates standing points and decay information
509
1024
  */
510
- declare function updateResultPoints(id: string, linearPoints: number, dynamicPoints: number, totalPoints: number): Promise<TournamentResult>;
1025
+ declare function updateStandingPoints(id: string, linearPoints: number, dynamicPoints: number, totalPoints: number): Promise<Standing>;
511
1026
  /**
512
- * Deletes a tournament result
1027
+ * Deletes a standing
513
1028
  */
514
- declare function deleteResult(id: string): Promise<TournamentResult>;
1029
+ declare function deleteStanding(id: string): Promise<Standing>;
515
1030
  /**
516
- * Deletes all results for a tournament
1031
+ * Deletes all standings for a tournament
517
1032
  */
518
- declare function deleteResultsByTournament(tournamentId: string): Promise<Prisma.BatchPayload>;
1033
+ declare function deleteStandingsByTournament(tournamentId: string): Promise<Prisma.BatchPayload>;
519
1034
  /**
520
- * Counts total results
1035
+ * Counts total standings
521
1036
  */
522
- declare function countResults(where?: Prisma.TournamentResultWhereInput): Promise<number>;
1037
+ declare function countStandings(where?: Prisma.StandingWhereInput): Promise<number>;
523
1038
  /**
524
1039
  * Gets player statistics across all tournaments
525
1040
  */
@@ -537,7 +1052,7 @@ declare function getPlayerStats(playerId: string): Promise<{
537
1052
  highestPoints: number;
538
1053
  } | null>;
539
1054
  /**
540
- * Calculates and updates time decay for all results
1055
+ * Calculates and updates time decay for all standings
541
1056
  * Based on OPPR time decay rules:
542
1057
  * - 0-1 years: 100%
543
1058
  * - 1-2 years: 75%
@@ -548,9 +1063,10 @@ declare function recalculateTimeDecay(referenceDate?: Date): Promise<{
548
1063
  id: string;
549
1064
  createdAt: Date;
550
1065
  updatedAt: Date;
551
- playerId: string;
552
1066
  tournamentId: string;
1067
+ playerId: string;
553
1068
  position: number;
1069
+ isFinals: boolean;
554
1070
  optedOut: boolean;
555
1071
  linearPoints: number | null;
556
1072
  dynamicPoints: number | null;
@@ -569,6 +1085,9 @@ interface CreateUserInput {
569
1085
  passwordHash: string;
570
1086
  playerId?: string;
571
1087
  role?: 'USER' | 'ADMIN';
1088
+ tosAcceptedAt?: Date;
1089
+ privacyPolicyAcceptedAt?: Date;
1090
+ codeOfConductAcceptedAt?: Date;
572
1091
  }
573
1092
  /**
574
1093
  * Input for updating a user
@@ -589,14 +1108,13 @@ interface UserWithPlayer {
589
1108
  role: 'USER' | 'ADMIN';
590
1109
  createdAt: Date;
591
1110
  updatedAt: Date;
1111
+ tosAcceptedAt: Date | null;
1112
+ privacyPolicyAcceptedAt: Date | null;
1113
+ codeOfConductAcceptedAt: Date | null;
592
1114
  player: {
593
1115
  id: string;
594
1116
  playerNumber: number;
595
1117
  name: string | null;
596
- rating: number;
597
- ratingDeviation: number;
598
- ranking: number | null;
599
- isRated: boolean;
600
1118
  eventCount: number;
601
1119
  } | null;
602
1120
  }
@@ -662,26 +1180,401 @@ declare function findUsers(params: {
662
1180
  */
663
1181
  declare function linkPlayerToUser(userId: string, playerId: string | null): Promise<UserWithPlayer>;
664
1182
 
1183
+ /**
1184
+ * Maximum number of API keys allowed per user
1185
+ */
1186
+ declare const MAX_API_KEYS_PER_USER = 5;
1187
+ /**
1188
+ * Input for creating a new API key
1189
+ */
1190
+ interface CreateApiKeyInput {
1191
+ name: string;
1192
+ keyPrefix: string;
1193
+ keyHash: string;
1194
+ userId: string;
1195
+ expiresAt?: Date | null;
1196
+ }
1197
+ /**
1198
+ * API key with user info (for authentication)
1199
+ */
1200
+ interface ApiKeyWithUser {
1201
+ id: string;
1202
+ name: string;
1203
+ keyPrefix: string;
1204
+ keyHash: string;
1205
+ expiresAt: Date | null;
1206
+ lastUsedAt: Date | null;
1207
+ createdAt: Date;
1208
+ userId: string;
1209
+ user: {
1210
+ id: string;
1211
+ email: string;
1212
+ role: 'USER' | 'ADMIN';
1213
+ };
1214
+ }
1215
+ /**
1216
+ * API key info for listing (without sensitive data)
1217
+ */
1218
+ interface ApiKeyInfo {
1219
+ id: string;
1220
+ name: string;
1221
+ keyPrefix: string;
1222
+ expiresAt: Date | null;
1223
+ lastUsedAt: Date | null;
1224
+ createdAt: Date;
1225
+ }
1226
+ /**
1227
+ * Creates a new API key
1228
+ */
1229
+ declare function createApiKey(data: CreateApiKeyInput): Promise<ApiKey>;
1230
+ /**
1231
+ * Finds an API key by ID
1232
+ */
1233
+ declare function findApiKeyById(id: string): Promise<ApiKey | null>;
1234
+ /**
1235
+ * Finds API keys by prefix with user data (for authentication)
1236
+ * Returns all keys matching the prefix so we can verify the hash
1237
+ */
1238
+ declare function findApiKeysByPrefix(keyPrefix: string): Promise<ApiKeyWithUser[]>;
1239
+ /**
1240
+ * Gets all API keys for a user (without sensitive data)
1241
+ */
1242
+ declare function getUserApiKeys(userId: string): Promise<ApiKeyInfo[]>;
1243
+ /**
1244
+ * Counts API keys for a user
1245
+ */
1246
+ declare function countUserApiKeys(userId: string): Promise<number>;
1247
+ /**
1248
+ * Updates the lastUsedAt timestamp for an API key
1249
+ */
1250
+ declare function updateApiKeyLastUsed(id: string): Promise<void>;
1251
+ /**
1252
+ * Deletes an API key
1253
+ */
1254
+ declare function deleteApiKey(id: string): Promise<ApiKey>;
1255
+ /**
1256
+ * Deletes an API key only if it belongs to the specified user
1257
+ * Returns null if the key doesn't exist or doesn't belong to the user
1258
+ */
1259
+ declare function deleteUserApiKey(id: string, userId: string): Promise<ApiKey | null>;
1260
+
1261
+ /**
1262
+ * Input for creating a new location
1263
+ */
1264
+ interface CreateLocationInput {
1265
+ externalId?: string;
1266
+ name: string;
1267
+ address?: string;
1268
+ city?: string;
1269
+ state?: string;
1270
+ country?: string;
1271
+ }
1272
+ /**
1273
+ * Input for updating a location
1274
+ */
1275
+ interface UpdateLocationInput {
1276
+ name?: string;
1277
+ address?: string | null;
1278
+ city?: string | null;
1279
+ state?: string | null;
1280
+ country?: string | null;
1281
+ }
1282
+ /**
1283
+ * Options for querying locations
1284
+ */
1285
+ interface FindLocationsOptions {
1286
+ take?: number;
1287
+ skip?: number;
1288
+ orderBy?: Prisma.LocationOrderByWithRelationInput;
1289
+ where?: Prisma.LocationWhereInput;
1290
+ include?: Prisma.LocationInclude;
1291
+ }
1292
+ /**
1293
+ * Creates a new location
1294
+ */
1295
+ declare function createLocation(data: CreateLocationInput): Promise<Location>;
1296
+ /**
1297
+ * Finds a location by ID
1298
+ */
1299
+ declare function findLocationById(id: string, include?: Prisma.LocationInclude): Promise<Location | null>;
1300
+ /**
1301
+ * Finds a location by external ID
1302
+ */
1303
+ declare function findLocationByExternalId(externalId: string, include?: Prisma.LocationInclude): Promise<Location | null>;
1304
+ /**
1305
+ * Finds multiple locations with optional filters
1306
+ */
1307
+ declare function findLocations(options?: FindLocationsOptions): Promise<Location[]>;
1308
+ /**
1309
+ * Searches locations by name or city
1310
+ */
1311
+ declare function searchLocations(query: string, limit?: number): Promise<Location[]>;
1312
+ /**
1313
+ * Updates a location
1314
+ */
1315
+ declare function updateLocation(id: string, data: UpdateLocationInput): Promise<Location>;
1316
+ /**
1317
+ * Deletes a location
1318
+ */
1319
+ declare function deleteLocation(id: string): Promise<Location>;
1320
+ /**
1321
+ * Counts total locations
1322
+ */
1323
+ declare function countLocations(where?: Prisma.LocationWhereInput): Promise<number>;
1324
+ /**
1325
+ * Gets location with its tournaments
1326
+ */
1327
+ declare function getLocationWithTournaments(id: string): Promise<({
1328
+ tournaments: {
1329
+ name: string;
1330
+ id: string;
1331
+ createdAt: Date;
1332
+ updatedAt: Date;
1333
+ externalId: string | null;
1334
+ externalUrl: string | null;
1335
+ description: string | null;
1336
+ date: Date;
1337
+ locationId: string | null;
1338
+ organizerId: string | null;
1339
+ tgpConfig: Prisma.JsonValue | null;
1340
+ eventBooster: _prisma_client.$Enums.EventBoosterType;
1341
+ allowsOptOut: boolean;
1342
+ baseValue: number | null;
1343
+ tvaRating: number | null;
1344
+ tvaRanking: number | null;
1345
+ totalTVA: number | null;
1346
+ tgp: number | null;
1347
+ eventBoosterMultiplier: number | null;
1348
+ firstPlaceValue: number | null;
1349
+ }[];
1350
+ } & {
1351
+ name: string;
1352
+ id: string;
1353
+ createdAt: Date;
1354
+ updatedAt: Date;
1355
+ externalId: string | null;
1356
+ address: string | null;
1357
+ city: string | null;
1358
+ state: string | null;
1359
+ country: string | null;
1360
+ }) | null>;
1361
+
1362
+ /**
1363
+ * BlogPost with author and tags included
1364
+ */
1365
+ type BlogPostWithRelations = BlogPost & {
1366
+ author: {
1367
+ id: string;
1368
+ email: string;
1369
+ };
1370
+ tags: {
1371
+ id: string;
1372
+ name: string;
1373
+ slug: string;
1374
+ }[];
1375
+ };
1376
+ /**
1377
+ * Input for creating a new blog post
1378
+ */
1379
+ interface CreateBlogPostInput {
1380
+ title: string;
1381
+ slug: string;
1382
+ content: string;
1383
+ excerpt?: string;
1384
+ status?: PostStatus;
1385
+ publishedAt?: Date;
1386
+ featuredImageUrl?: string;
1387
+ featuredImageAlt?: string;
1388
+ metaTitle?: string;
1389
+ metaDescription?: string;
1390
+ ogTitle?: string;
1391
+ ogDescription?: string;
1392
+ ogImageUrl?: string;
1393
+ authorId: string;
1394
+ tagIds?: string[];
1395
+ }
1396
+ /**
1397
+ * Input for updating a blog post
1398
+ */
1399
+ interface UpdateBlogPostInput {
1400
+ title?: string;
1401
+ slug?: string;
1402
+ content?: string;
1403
+ excerpt?: string | null;
1404
+ status?: PostStatus;
1405
+ publishedAt?: Date | null;
1406
+ featuredImageUrl?: string | null;
1407
+ featuredImageAlt?: string | null;
1408
+ metaTitle?: string | null;
1409
+ metaDescription?: string | null;
1410
+ ogTitle?: string | null;
1411
+ ogDescription?: string | null;
1412
+ ogImageUrl?: string | null;
1413
+ tagIds?: string[];
1414
+ }
1415
+ /**
1416
+ * Options for querying blog posts
1417
+ */
1418
+ interface FindBlogPostsOptions {
1419
+ take?: number;
1420
+ skip?: number;
1421
+ orderBy?: Prisma.BlogPostOrderByWithRelationInput;
1422
+ where?: Prisma.BlogPostWhereInput;
1423
+ include?: Prisma.BlogPostInclude;
1424
+ }
1425
+ /**
1426
+ * Creates a new blog post
1427
+ */
1428
+ declare function createBlogPost(data: CreateBlogPostInput): Promise<BlogPostWithRelations>;
1429
+ /**
1430
+ * Finds a blog post by ID
1431
+ */
1432
+ declare function findBlogPostById(id: string): Promise<BlogPostWithRelations | null>;
1433
+ /**
1434
+ * Finds a blog post by slug
1435
+ */
1436
+ declare function findBlogPostBySlug(slug: string): Promise<BlogPostWithRelations | null>;
1437
+ /**
1438
+ * Finds multiple blog posts with optional filters
1439
+ */
1440
+ declare function findBlogPosts(options?: FindBlogPostsOptions): Promise<BlogPostWithRelations[]>;
1441
+ /**
1442
+ * Finds only published blog posts (for public access)
1443
+ */
1444
+ declare function findPublishedBlogPosts(options?: Omit<FindBlogPostsOptions, 'where'> & {
1445
+ tagSlug?: string;
1446
+ }): Promise<BlogPostWithRelations[]>;
1447
+ /**
1448
+ * Searches blog posts by title or content
1449
+ */
1450
+ declare function searchBlogPosts(query: string, limit?: number, publishedOnly?: boolean): Promise<BlogPostWithRelations[]>;
1451
+ /**
1452
+ * Updates a blog post
1453
+ */
1454
+ declare function updateBlogPost(id: string, data: UpdateBlogPostInput): Promise<BlogPostWithRelations>;
1455
+ /**
1456
+ * Deletes a blog post
1457
+ */
1458
+ declare function deleteBlogPost(id: string): Promise<BlogPost>;
1459
+ /**
1460
+ * Counts total blog posts
1461
+ */
1462
+ declare function countBlogPosts(where?: Prisma.BlogPostWhereInput): Promise<number>;
1463
+ /**
1464
+ * Counts published blog posts (for public access)
1465
+ */
1466
+ declare function countPublishedBlogPosts(tagSlug?: string): Promise<number>;
1467
+
1468
+ /**
1469
+ * Input for creating a new blog tag
1470
+ */
1471
+ interface CreateBlogTagInput {
1472
+ name: string;
1473
+ slug: string;
1474
+ description?: string;
1475
+ }
1476
+ /**
1477
+ * Input for updating a blog tag
1478
+ */
1479
+ interface UpdateBlogTagInput {
1480
+ name?: string;
1481
+ slug?: string;
1482
+ description?: string | null;
1483
+ }
1484
+ /**
1485
+ * Options for querying blog tags
1486
+ */
1487
+ interface FindBlogTagsOptions {
1488
+ take?: number;
1489
+ skip?: number;
1490
+ orderBy?: Prisma.BlogTagOrderByWithRelationInput;
1491
+ where?: Prisma.BlogTagWhereInput;
1492
+ include?: Prisma.BlogTagInclude;
1493
+ }
1494
+ /**
1495
+ * Creates a new blog tag
1496
+ */
1497
+ declare function createBlogTag(data: CreateBlogTagInput): Promise<BlogTag>;
1498
+ /**
1499
+ * Finds a blog tag by ID
1500
+ */
1501
+ declare function findBlogTagById(id: string): Promise<BlogTag | null>;
1502
+ /**
1503
+ * Finds a blog tag by slug
1504
+ */
1505
+ declare function findBlogTagBySlug(slug: string): Promise<BlogTag | null>;
1506
+ /**
1507
+ * Finds multiple blog tags with optional filters
1508
+ */
1509
+ declare function findBlogTags(options?: FindBlogTagsOptions): Promise<BlogTag[]>;
1510
+ /**
1511
+ * Searches blog tags by name
1512
+ */
1513
+ declare function searchBlogTags(query: string, limit?: number): Promise<BlogTag[]>;
1514
+ /**
1515
+ * Updates a blog tag
1516
+ */
1517
+ declare function updateBlogTag(id: string, data: UpdateBlogTagInput): Promise<BlogTag>;
1518
+ /**
1519
+ * Deletes a blog tag
1520
+ */
1521
+ declare function deleteBlogTag(id: string): Promise<BlogTag>;
1522
+ /**
1523
+ * Counts total blog tags
1524
+ */
1525
+ declare function countBlogTags(where?: Prisma.BlogTagWhereInput): Promise<number>;
1526
+ /**
1527
+ * Gets blog tag with post count
1528
+ */
1529
+ declare function getBlogTagWithPostCount(id: string): Promise<({
1530
+ _count: {
1531
+ posts: number;
1532
+ };
1533
+ } & {
1534
+ name: string;
1535
+ id: string;
1536
+ createdAt: Date;
1537
+ updatedAt: Date;
1538
+ description: string | null;
1539
+ slug: string;
1540
+ }) | null>;
1541
+ /**
1542
+ * Gets all blog tags with post counts
1543
+ */
1544
+ declare function getBlogTagsWithPostCounts(): Promise<({
1545
+ _count: {
1546
+ posts: number;
1547
+ };
1548
+ } & {
1549
+ name: string;
1550
+ id: string;
1551
+ createdAt: Date;
1552
+ updatedAt: Date;
1553
+ description: string | null;
1554
+ slug: string;
1555
+ })[]>;
1556
+
665
1557
  /**
666
1558
  * Re-export Prisma generated types
667
1559
  */
668
1560
 
669
1561
  /**
670
- * Player with full tournament results
1562
+ * Player with full tournament standings
671
1563
  */
672
1564
  interface PlayerWithResults {
673
1565
  player: Player;
674
- results: TournamentResultWithTournament[];
1566
+ results: StandingWithTournament[];
675
1567
  stats: PlayerStatistics;
676
1568
  }
677
1569
  /**
678
- * Tournament result with tournament details
1570
+ * Standing with tournament details
679
1571
  */
680
- interface TournamentResultWithTournament {
1572
+ interface StandingWithTournament {
681
1573
  id: string;
682
1574
  position: number;
683
- totalPoints: number;
684
- decayedPoints: number;
1575
+ isFinals: boolean;
1576
+ totalPoints: number | null;
1577
+ decayedPoints: number | null;
685
1578
  tournament: {
686
1579
  id: string;
687
1580
  name: string;
@@ -721,4 +1614,4 @@ interface ConnectionStatus {
721
1614
  error?: string;
722
1615
  }
723
1616
 
724
- export { type ConnectionStatus, type CreatePlayerInput, type CreateResultInput, type CreateTournamentInput, type CreateUserInput, type FindPlayersOptions, type FindResultsOptions, type FindTournamentsOptions, type PlayerStatistics, type PlayerWithResults, type TournamentResultWithTournament, type TournamentStatistics, type UpdatePlayerInput, type UpdateResultInput, type UpdateTournamentInput, type UpdateUserInput, type UserWithPlayer, connect, countPlayers, countResults, countTournaments, countUsers, createManyResults, createPlayer, createResult, createTournament, createUser, createUserWithPlayer, deletePlayer, deleteResult, deleteResultsByTournament, deleteTournament, deleteUser, disconnect, findPlayerByExternalId, findPlayerById, findPlayerByPlayerNumber, findPlayerByUserEmail, findPlayers, findResultById, findResultByPlayerAndTournament, findResults, findTournamentByExternalId, findTournamentById, findTournaments, findUserByEmail, findUserById, findUsers, generateUniquePlayerNumber, getMajorTournaments, getPlayerResults, getPlayerStats, getPlayerTopFinishes, getPlayerWithResults, getRatedPlayers, getRecentTournaments, getTopPlayersByRanking, getTopPlayersByRating, getTournamentResults, getTournamentStats, getTournamentWithResults, getTournamentsByBoosterType, getTournamentsByDateRange, getUserByEmailWithPlayer, getUserWithPlayer, isValidPlayerNumber, linkPlayerToUser, prisma, recalculateTimeDecay, searchPlayers, searchTournaments, testConnection, updatePlayer, updatePlayerRating, updateResult, updateResultPoints, updateTournament, updateUser, updateUserRefreshToken };
1617
+ export { type ApiKeyInfo, type ApiKeyWithUser, type BlogPostWithRelations, type ConnectionStatus, type CreateApiKeyInput, type CreateBlogPostInput, type CreateBlogTagInput, type CreateEntryInput, type CreateLocationInput, type CreateMatchInput, type CreateOpprPlayerRankingInput, type CreateOpprRankingHistoryInput, type CreatePlayerInput, type CreateRoundInput, type CreateStandingInput, type CreateTournamentInput, type CreateUserInput, type FindBlogPostsOptions, type FindBlogTagsOptions, 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 UpdateBlogPostInput, type UpdateBlogTagInput, type UpdateEntryInput, type UpdateLocationInput, type UpdateMatchInput, type UpdateOpprPlayerRankingInput, type UpdatePlayerInput, type UpdateRoundInput, type UpdateStandingInput, type UpdateTournamentInput, type UpdateUserInput, type UserWithPlayer, applyRDDecayForInactivePlayers, connect, countBlogPosts, countBlogTags, countEntries, countLocations, countMatches, countOpprPlayerRankings, countOpprRankingHistory, countPlayers, countPublishedBlogPosts, countRounds, countStandings, countTournaments, countUserApiKeys, countUsers, createApiKey, createBlogPost, createBlogTag, createEntry, createLocation, createManyEntries, createManyMatches, createManyRounds, createManyStandings, createMatch, createOpprPlayerRanking, createOpprRankingHistory, createPlayer, createRound, createStanding, createTournament, createUser, createUserWithPlayer, deleteApiKey, deleteBlogPost, deleteBlogTag, deleteEntriesByMatch, deleteEntry, deleteLocation, deleteMatch, deleteMatchesByRound, deleteMatchesByTournament, deleteOpprPlayerRanking, deletePlayer, deleteRound, deleteRoundsByTournament, deleteStanding, deleteStandingsByTournament, deleteTournament, deleteUser, deleteUserApiKey, disconnect, findApiKeyById, findApiKeysByPrefix, findBlogPostById, findBlogPostBySlug, findBlogPosts, findBlogTagById, findBlogTagBySlug, findBlogTags, findEntries, findEntryById, findEntryByMatchAndPlayer, findLocationByExternalId, findLocationById, findLocations, findMatchById, findMatches, findOpprPlayerRankingById, findOpprPlayerRankingByPlayerId, findOpprPlayerRankings, findPlayerByExternalId, findPlayerById, findPlayerByPlayerNumber, findPlayerByUserEmail, findPlayers, findPublishedBlogPosts, findRoundById, findRoundByTournamentAndNumber, findRounds, findStandingById, findStandingByPlayerAndTournament, findStandings, findTournamentByExternalId, findTournamentById, findTournaments, findUserByEmail, findUserById, findUsers, generateUniquePlayerNumber, getBlogTagWithPostCount, getBlogTagsWithPostCounts, 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, searchBlogPosts, searchBlogTags, searchLocations, searchPlayers, searchTournaments, testConnection, updateApiKeyLastUsed, updateBlogPost, updateBlogTag, updateEntry, updateLocation, updateMatch, updateOpprPlayerRanking, updateOpprRatingAfterTournament, updatePlayer, updateRound, updateStanding, updateStandingPoints, updateTournament, updateUser, updateUserRefreshToken, updateWorldRankings };