@levrbet/shared 0.5.76 → 0.5.77

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.
@@ -0,0 +1,209 @@
1
+ enum GamePhase {
2
+ PreGame
3
+ LiveGame
4
+ PostGame
5
+ Cancelled
6
+ }
7
+
8
+ enum ScoringType {
9
+ Points
10
+ Goals
11
+ }
12
+
13
+ enum FixtureStatus {
14
+ Scheduled
15
+ Cancelled
16
+ }
17
+
18
+ enum SportGroup {
19
+ Football
20
+ Basketball
21
+ Baseball
22
+ Soccer
23
+ Hockey
24
+ Esports
25
+ }
26
+
27
+ model Provider {
28
+ objectId String @id @default(auto()) @map("_id") @db.ObjectId
29
+ name String @unique
30
+ providerUrl String @unique
31
+
32
+ createdAt DateTime @default(now())
33
+ updatedAt DateTime @updatedAt
34
+ }
35
+
36
+ model Tournament {
37
+ objectId String @id @default(auto()) @map("_id") @db.ObjectId
38
+ levrTournamentId String @unique
39
+ chainId Int
40
+ name String
41
+ description String
42
+ bannerUrl String
43
+ startDate DateTime
44
+ endDate DateTime
45
+
46
+ games LevrGame[]
47
+ leagues League[]
48
+
49
+ createdAt DateTime @default(now())
50
+ updatedAt DateTime @updatedAt
51
+
52
+ @@unique([chainId, name])
53
+ @@unique([chainId, description])
54
+ @@unique([chainId, bannerUrl])
55
+ @@index([name])
56
+ }
57
+
58
+ model Sport {
59
+ objectId String @id @default(auto()) @map("_id") @db.ObjectId
60
+ levrSportId String @unique
61
+ name String @unique
62
+ periodType String
63
+ scoringType ScoringType
64
+ standardDurationMs Int
65
+ standardPeriods Int
66
+ periodDuration Int?
67
+ hasDrawMarket Boolean
68
+ sportGroup SportGroup
69
+
70
+ leagues League[]
71
+
72
+ createdAt DateTime @default(now())
73
+ updatedAt DateTime @updatedAt
74
+ }
75
+
76
+ model League {
77
+ objectId String @id @default(auto()) @map("_id") @db.ObjectId
78
+ name String @unique
79
+ abbreviation String
80
+ country String
81
+ levrLeagueId String @unique
82
+ opticOddsLeagueId String
83
+ lsportsLeagueId String @unique
84
+ logoKey String
85
+ logoUrl String
86
+
87
+ tournamentObjectId String @db.ObjectId
88
+ tournament Tournament @relation(fields: [tournamentObjectId], references: [objectId])
89
+ sportObjectId String @db.ObjectId
90
+ sport Sport @relation(fields: [sportObjectId], references: [objectId])
91
+ levrSportId String
92
+
93
+ games LevrGame[]
94
+ fixtures Fixture[]
95
+ teams TeamData[]
96
+
97
+ createdAt DateTime @default(now())
98
+ updatedAt DateTime @updatedAt
99
+ }
100
+
101
+ model TeamData {
102
+ objectId String @id @default(auto()) @map("_id") @db.ObjectId
103
+ levrTeamName String
104
+ levrTeamOfficialAbbreviation String
105
+ lsportsTeamName String
106
+ opticOddsTeamName String
107
+ lsportsTeamId String
108
+ opticOddsTeamId String
109
+ levrTeamId String
110
+ opticOddsTeamLogoUrl String
111
+ levrTeamLogoUrlAsHome String @unique
112
+ levrTeamLogoUrlAsAway String @unique
113
+ leagueObjectId String @db.ObjectId
114
+ levrLeagueId String
115
+ league League @relation(fields: [leagueObjectId], references: [objectId])
116
+
117
+ @@unique([levrTeamId, levrTeamName, leagueObjectId])
118
+ }
119
+
120
+ model Fixture {
121
+ objectId String @id @default(auto()) @map("_id") @db.ObjectId
122
+ levrFixtureId String @unique
123
+ opticOddsFixtureId String? @unique
124
+ lsportsFixtureId String? @unique
125
+ seasonType String
126
+ venue String
127
+ eventName String
128
+ location String
129
+ venueLocation String
130
+ fixtureDate DateTime
131
+ lastUpdated DateTime
132
+ homeTeam Json
133
+ awayTeam Json
134
+ fixtureStatus FixtureStatus
135
+ sportGroup SportGroup? //optional for now so we don't break staging
136
+ registeredChainIds Int[] // list of chain IDs where this fixture is registered
137
+
138
+ leagueObjectId String @db.ObjectId
139
+ league League @relation(fields: [leagueObjectId], references: [objectId])
140
+
141
+ createdAt DateTime @default(now())
142
+ updatedAt DateTime @updatedAt
143
+
144
+ @@index([fixtureDate])
145
+ @@index([leagueObjectId])
146
+ @@index([eventName])
147
+ }
148
+
149
+ model Scores {
150
+ objectId String @id @default(auto()) @map("_id") @db.ObjectId
151
+ scoresByPeriodHome Json
152
+ scoresByPeriodAway Json
153
+ totalScoresHome Float
154
+ totalScoresAway Float
155
+ chainId Int
156
+
157
+ gameObjectId String @unique @db.ObjectId
158
+ LevrGame LevrGame @relation(fields: [gameObjectId], references: [objectId])
159
+
160
+ createdAt DateTime @default(now())
161
+ updatedAt DateTime @updatedAt
162
+ }
163
+
164
+ model LevrGame {
165
+ objectId String @id @default(auto()) @map("_id") @db.ObjectId
166
+ gameId Int @unique
167
+ txHash String @unique
168
+ chainId Int
169
+ seasonType String
170
+ venue String
171
+ eventName String
172
+ location String
173
+ venueLocation String
174
+ gameClock String
175
+ gameProgressBps Int @default(0)
176
+ paused Boolean @default(false)
177
+ fixtureDate DateTime
178
+ wentLiveAt DateTime?
179
+ homeTeam Json // as defined in sample-data/lever/levr-game.json
180
+ awayTeam Json // as defined in sample-data/lever/levr-game.json
181
+ currentPeriod Int @default(0)
182
+ actualDuration Float @default(0) // in milliseconds
183
+ gamePhase GamePhase @default(PreGame)
184
+ levrFixtureId String
185
+ opticOddsFixtureId String?
186
+ lsportsFixtureId String?
187
+ liveScoreMatchId String?
188
+
189
+ sportGroup SportGroup
190
+
191
+ tournamentObjectId String @db.ObjectId
192
+ fixtureObjectId String @db.ObjectId
193
+ tournament Tournament @relation(fields: [tournamentObjectId], references: [objectId])
194
+ leagueObjectId String @db.ObjectId
195
+ league League @relation(fields: [leagueObjectId], references: [objectId])
196
+ scores Scores?
197
+
198
+ markets Market[]
199
+
200
+ createdAt DateTime @default(now())
201
+ updatedAt DateTime @updatedAt
202
+
203
+ @@unique([chainId, levrFixtureId])
204
+ @@unique([chainId, gameId])
205
+ @@index([opticOddsFixtureId])
206
+ @@index([lsportsFixtureId])
207
+ @@index([eventName])
208
+ @@index([fixtureDate])
209
+ }
@@ -0,0 +1,71 @@
1
+ enum UserOddsPreference {
2
+ American
3
+ Decimal
4
+ European
5
+ }
6
+
7
+ enum TransactionHistoryType {
8
+ Deposit
9
+ Withdrawal
10
+ Wager
11
+ }
12
+
13
+ enum TransactionHistoryStatus {
14
+ Completed
15
+ Pending
16
+ Failed
17
+ }
18
+
19
+ enum TransactionHistoryDescription {
20
+ BetPlaced
21
+ Deposited
22
+ Withdrawn
23
+ }
24
+
25
+ model User {
26
+ objectId String @id @default(auto()) @map("_id") @db.ObjectId
27
+ walletAddress String @unique
28
+ userName String?
29
+ email String?
30
+ referralCode String? @unique
31
+ referrerCode String?
32
+ timeZone String @default("UTC")
33
+ preferredTimeZone String?
34
+ userOddsPreference UserOddsPreference @default(American)
35
+ profileImageUrl String?
36
+ profileImageKey String?
37
+ language String @default("en")
38
+ showRiskWarnings Boolean @default(true)
39
+ showPreTransactionReminders Boolean @default(true)
40
+ twoFactorEnabled Boolean @default(false)
41
+ autoDetectTimeZone Boolean @default(true)
42
+ autoApproveTxs Boolean @default(false)
43
+ requireWithdrawalConfirmation Boolean @default(true)
44
+
45
+ // Inverse relations (these fix your P1012 errors)
46
+ referralsMade Referral[] @relation("ReferrerRelations") // users they referred
47
+ referredBy Referral[] @relation("ReferredRelations") // who referred them
48
+ referralRewards ReferralReward[] @relation("UserRewards") // their reward entries
49
+ transactionHistory TransactionHistory[] @relation("TransactionHistory") // transaction history
50
+ notifications Notification[] @relation("UserNotifications") // in-app notifications
51
+
52
+ createdAt DateTime @default(now())
53
+ updatedAt DateTime @updatedAt
54
+ }
55
+
56
+ model TransactionHistory {
57
+ objectId String @id @default(cuid()) @map("_id")
58
+ id String
59
+ type TransactionHistoryType
60
+ status TransactionHistoryStatus
61
+ timestamp DateTime @default(now())
62
+ balance Float
63
+ description TransactionHistoryDescription
64
+ amount Float
65
+ // Relations
66
+ walletAddress String
67
+ user User @relation("TransactionHistory", fields: [walletAddress], references: [walletAddress])
68
+
69
+ @@index([timestamp])
70
+ @@index([walletAddress])
71
+ }
@@ -5,7 +5,7 @@
5
5
  * Automatically generates Prisma client using the schema bundled in this package.
6
6
  *
7
7
  * This runs automatically when consumers install @levrbet/shared.
8
- * The schema.prisma stays in this package - no files are copied to the consumer.
8
+ * The Prisma schema stays in this package - no files are copied to the consumer.
9
9
  */
10
10
 
11
11
  const { execSync } = require("child_process")
@@ -78,11 +78,11 @@ function main() {
78
78
 
79
79
  const projectRoot = findProjectRoot()
80
80
  const packageDir = path.join(__dirname, "..")
81
- const schemaPath = path.join(packageDir, "prisma", "schema.prisma")
81
+ const schemaPath = path.join(packageDir, "prisma")
82
82
 
83
83
  // Verify schema exists
84
84
  if (!fs.existsSync(schemaPath)) {
85
- console.error("[@levrbet/shared] Error: schema.prisma not found at", schemaPath)
85
+ console.error("[@levrbet/shared] Error: Prisma schema directory not found at", schemaPath)
86
86
  process.exit(1)
87
87
  }
88
88
 
@@ -101,7 +101,7 @@ function main() {
101
101
  } catch (err) {
102
102
  console.error("[@levrbet/shared] Failed to generate Prisma client:", err.message)
103
103
  console.error(
104
- "[@levrbet/shared] You may need to run: npx prisma generate --schema=node_modules/@levrbet/shared/prisma/schema.prisma"
104
+ "[@levrbet/shared] You may need to run: npx prisma generate --schema=node_modules/@levrbet/shared/prisma"
105
105
  )
106
106
  // Don't exit with error - allow install to complete even if generation fails
107
107
  // This prevents blocking installs when @prisma/client isn't yet installed