mirror of
https://github.com/cassoule/flopobot_v2.git
synced 2026-03-18 13:30:36 +01:00
200 lines
5.5 KiB
Plaintext
200 lines
5.5 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "sqlite"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id String @id
|
|
username String
|
|
globalName String?
|
|
warned Int @default(0)
|
|
warns Int @default(0)
|
|
allTimeWarns Int @default(0)
|
|
totalRequests Int @default(0)
|
|
coins Int @default(0)
|
|
dailyQueried Int @default(0)
|
|
avatarUrl String?
|
|
isAkhy Int @default(0)
|
|
|
|
elo Elo?
|
|
skins Skin[]
|
|
csSkins CsSkin[] @relation("CsSkins")
|
|
sellerOffers MarketOffer[] @relation("Seller")
|
|
buyerOffers MarketOffer[] @relation("Buyer")
|
|
bids Bid[]
|
|
logs Log[] @relation("UserLogs")
|
|
targetLogs Log[] @relation("TargetUserLogs")
|
|
gamesAsP1 Game[] @relation("Player1")
|
|
gamesAsP2 Game[] @relation("Player2")
|
|
sotdStats SotdStat[]
|
|
transactions Transaction[]
|
|
|
|
@@map("users")
|
|
}
|
|
|
|
model Skin {
|
|
uuid String @id
|
|
displayName String?
|
|
contentTierUuid String?
|
|
displayIcon String?
|
|
userId String? @map("user_id")
|
|
tierRank String?
|
|
tierColor String?
|
|
tierText String?
|
|
basePrice String?
|
|
currentLvl Int?
|
|
currentChroma Int?
|
|
currentPrice Int?
|
|
maxPrice Int?
|
|
|
|
owner User? @relation(fields: [userId], references: [id])
|
|
marketOffers MarketOffer[]
|
|
|
|
@@map("skins")
|
|
}
|
|
|
|
model CsSkin {
|
|
id String @id @default(uuid())
|
|
marketHashName String @map("market_hash_name")
|
|
displayName String?
|
|
imageUrl String? @map("image_url")
|
|
rarity String?
|
|
rarityColor String? @map("rarity_color")
|
|
weaponType String? @map("weapon_type")
|
|
float Float?
|
|
wearState String? @map("wear_state")
|
|
isStattrak Boolean @default(false) @map("is_stattrak")
|
|
isSouvenir Boolean @default(false) @map("is_souvenir")
|
|
price Int?
|
|
userId String? @map("user_id")
|
|
|
|
owner User? @relation("CsSkins", fields: [userId], references: [id])
|
|
marketOffers MarketOffer[] @relation("CsSkinOffers")
|
|
|
|
@@map("cs_skins")
|
|
}
|
|
|
|
model MarketOffer {
|
|
id String @id
|
|
skinUuid String? @map("skin_uuid")
|
|
csSkinId String? @map("cs_skin_id")
|
|
sellerId String @map("seller_id")
|
|
startingPrice Int @map("starting_price")
|
|
buyoutPrice Int? @map("buyout_price")
|
|
finalPrice Int? @map("final_price")
|
|
status String
|
|
postedAt DateTime? @default(now()) @map("posted_at")
|
|
openingAt DateTime @map("opening_at")
|
|
closingAt DateTime @map("closing_at")
|
|
buyerId String? @map("buyer_id")
|
|
|
|
skin Skin? @relation(fields: [skinUuid], references: [uuid])
|
|
csSkin CsSkin? @relation("CsSkinOffers", fields: [csSkinId], references: [id])
|
|
seller User @relation("Seller", fields: [sellerId], references: [id])
|
|
buyer User? @relation("Buyer", fields: [buyerId], references: [id])
|
|
bids Bid[]
|
|
|
|
@@map("market_offers")
|
|
}
|
|
|
|
model Bid {
|
|
id String @id
|
|
bidderId String @map("bidder_id")
|
|
marketOfferId String @map("market_offer_id")
|
|
offerAmount Int @map("offer_amount")
|
|
offeredAt DateTime? @default(now()) @map("offered_at")
|
|
|
|
bidder User @relation(fields: [bidderId], references: [id])
|
|
marketOffer MarketOffer @relation(fields: [marketOfferId], references: [id])
|
|
|
|
@@map("bids")
|
|
}
|
|
|
|
model Log {
|
|
id String @id
|
|
userId String @map("user_id")
|
|
action String?
|
|
targetUserId String? @map("target_user_id")
|
|
coinsAmount Int? @map("coins_amount")
|
|
userNewAmount Int? @map("user_new_amount")
|
|
createdAt DateTime? @default(now()) @map("created_at")
|
|
|
|
user User @relation("UserLogs", fields: [userId], references: [id])
|
|
targetUser User? @relation("TargetUserLogs", fields: [targetUserId], references: [id])
|
|
|
|
@@map("logs")
|
|
}
|
|
|
|
model Game {
|
|
id String @id
|
|
p1 String
|
|
p2 String?
|
|
p1Score Int? @map("p1_score")
|
|
p2Score Int? @map("p2_score")
|
|
p1Elo Int? @map("p1_elo")
|
|
p2Elo Int? @map("p2_elo")
|
|
p1NewElo Int? @map("p1_new_elo")
|
|
p2NewElo Int? @map("p2_new_elo")
|
|
type String?
|
|
timestamp DateTime? @default(now()) @map("timestamp")
|
|
|
|
player1 User @relation("Player1", fields: [p1], references: [id])
|
|
player2 User? @relation("Player2", fields: [p2], references: [id])
|
|
|
|
@@map("games")
|
|
}
|
|
|
|
model Elo {
|
|
id String @id
|
|
elo Int
|
|
|
|
user User @relation(fields: [id], references: [id])
|
|
|
|
@@map("elos")
|
|
}
|
|
|
|
model Sotd {
|
|
id Int @id
|
|
tableauPiles String?
|
|
foundationPiles String?
|
|
stockPile String?
|
|
wastePile String?
|
|
isDone Int @default(0)
|
|
seed String?
|
|
|
|
@@map("sotd")
|
|
}
|
|
|
|
model SotdStat {
|
|
id String @id
|
|
userId String @map("user_id")
|
|
time Int?
|
|
moves Int?
|
|
score Int?
|
|
|
|
user User @relation(fields: [userId], references: [id])
|
|
|
|
@@map("sotd_stats")
|
|
}
|
|
|
|
model Transaction {
|
|
id String @id
|
|
sessionId String @unique @map("session_id")
|
|
userId String @map("user_id")
|
|
coinsAmount Int @map("coins_amount")
|
|
amountCents Int @map("amount_cents")
|
|
currency String @default("eur")
|
|
customerEmail String? @map("customer_email")
|
|
customerName String? @map("customer_name")
|
|
paymentStatus String @map("payment_status")
|
|
createdAt DateTime? @default(now()) @map("created_at")
|
|
|
|
user User @relation(fields: [userId], references: [id])
|
|
|
|
@@map("transactions")
|
|
}
|