@opprs/db-prisma 2.5.0 → 3.0.0-canary.50eebd8

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.
@@ -27,7 +27,6 @@ model Player {
27
27
 
28
28
  // Relations
29
29
  standings Standing[]
30
- entries Entry[]
31
30
  user User?
32
31
  organizedTournaments Tournament[] @relation("OrganizedTournaments")
33
32
  opprRanking OpprPlayerRanking?
@@ -44,6 +43,7 @@ model Tournament {
44
43
 
45
44
  // Tournament identification
46
45
  externalId String? @unique // External ID from OPPR or other systems
46
+ externalUrl String? // URL to external tournament page (e.g., IFPA, Matchplay)
47
47
  name String
48
48
  description String? @db.VarChar(2000)
49
49
  date DateTime
@@ -62,6 +62,7 @@ model Tournament {
62
62
 
63
63
  // Event classification
64
64
  eventBooster EventBoosterType @default(NONE)
65
+ qualifyingFormat TournamentFormatType @default(NONE)
65
66
  allowsOptOut Boolean @default(false)
66
67
 
67
68
  // Tournament value calculations (can be calculated or cached)
@@ -74,8 +75,6 @@ model Tournament {
74
75
  firstPlaceValue Float?
75
76
 
76
77
  // Relations
77
- rounds Round[]
78
- matches Match[]
79
78
  standings Standing[]
80
79
  rankingHistoryRecords OpprRankingHistory[]
81
80
 
@@ -86,67 +85,6 @@ model Tournament {
86
85
  @@index([organizerId])
87
86
  }
88
87
 
89
- // Round model - groups matches within a tournament stage
90
- model Round {
91
- id String @id @default(cuid())
92
- createdAt DateTime @default(now())
93
- updatedAt DateTime @updatedAt
94
-
95
- tournamentId String
96
- tournament Tournament @relation(fields: [tournamentId], references: [id], onDelete: Cascade)
97
-
98
- number Int // Round number within the stage (1, 2, 3...)
99
- name String? // Optional name (e.g., "Quarterfinals", "Semifinal")
100
- isFinals Boolean @default(false)
101
-
102
- // Relations
103
- matches Match[]
104
-
105
- @@unique([tournamentId, number, isFinals])
106
- @@index([tournamentId])
107
- @@index([tournamentId, isFinals])
108
- }
109
-
110
- // Match model - a single game with 1-4 players
111
- model Match {
112
- id String @id @default(cuid())
113
- createdAt DateTime @default(now())
114
- updatedAt DateTime @updatedAt
115
-
116
- tournamentId String
117
- tournament Tournament @relation(fields: [tournamentId], references: [id], onDelete: Cascade)
118
- roundId String?
119
- round Round? @relation(fields: [roundId], references: [id], onDelete: SetNull)
120
-
121
- number Int? // Match number within the round
122
- machineName String? // Machine played on
123
-
124
- // Relations
125
- entries Entry[]
126
-
127
- @@index([tournamentId])
128
- @@index([roundId])
129
- }
130
-
131
- // Entry model - a player's participation in a match
132
- model Entry {
133
- id String @id @default(cuid())
134
- createdAt DateTime @default(now())
135
- updatedAt DateTime @updatedAt
136
-
137
- matchId String
138
- match Match @relation(fields: [matchId], references: [id], onDelete: Cascade)
139
- playerId String
140
- player Player @relation(fields: [playerId], references: [id], onDelete: Cascade)
141
-
142
- result MatchResult // WIN, LOSS, TIE
143
- position Int? // Position within the match (1st, 2nd, 3rd, 4th for group games)
144
-
145
- @@unique([matchId, playerId])
146
- @@index([matchId])
147
- @@index([playerId])
148
- }
149
-
150
88
  // Standing model - final position for qualifying or finals
151
89
  model Standing {
152
90
  id String @id @default(cuid())
@@ -178,13 +116,6 @@ model Standing {
178
116
  @@index([position])
179
117
  }
180
118
 
181
- // Enum for match results
182
- enum MatchResult {
183
- WIN
184
- LOSS
185
- TIE
186
- }
187
-
188
119
  // Enum for event booster types
189
120
  enum EventBoosterType {
190
121
  NONE
@@ -194,6 +125,21 @@ enum EventBoosterType {
194
125
  MAJOR
195
126
  }
196
127
 
128
+ // Enum for tournament format types (qualifying and finals)
129
+ enum TournamentFormatType {
130
+ SINGLE_ELIMINATION
131
+ DOUBLE_ELIMINATION
132
+ MATCH_PLAY
133
+ BEST_GAME
134
+ CARD_QUALIFYING
135
+ PIN_GOLF
136
+ FLIP_FRENZY
137
+ STRIKE_FORMAT
138
+ TARGET_MATCH_PLAY
139
+ HYBRID
140
+ NONE
141
+ }
142
+
197
143
  // Enum for user roles
198
144
  enum Role {
199
145
  USER