Files
lokiloto/prisma/schema.prisma
T
Nazim KriandClaude Opus 5.5 e97b2e54ad Country selector in the header, auto-detected and remembered
Replaces the left sidebar with a header dropdown (flag + name), like
1xbet's region picker. The shown country resolves as: saved choice
(cookie, then the member's profile so it follows them across devices),
else Cloudflare's CF-IPCountry (Canada maps to Québec), else Québec.
favoriteCountry becomes nullable so geo-detection isn't overridden by
a default nobody chose. Emoji flags render as letters on Windows, so
flags are now SVGs in /public/flags; country names are in French.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 09:58:33 -04:00

54 lines
1.9 KiB
Plaintext

generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
/// A member account, created on email+password signup or Google sign-in —
/// same dual-path pattern as LokiLab (lib/member-password.ts / google-oauth.ts).
model User {
id String @id @default(cuid())
email String @unique
name String
avatarUrl String?
googleSub String? @unique
/// scrypt hash, format `scrypt$<salt>$<hex>`. Null when the account was
/// created via Google only.
passwordHash String?
/// Shown instead of name/email anywhere this member's activity is public
/// (leaderboard, follow counts). Must be set before a member appears
/// publicly.
publicNickname String?
/// Country the member explicitly picked in the header selector — synced
/// across devices. Null until they pick one, so geo-detection applies.
favoriteCountry String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
follows FollowedPick[]
}
/// A member "following" one of Loki's picks for a specific upcoming draw —
/// the leaderboard is built from how many of these resolve as wins. No
/// money, no pooled play: this only records that a member said "I'm
/// tracking this one," same spirit as LokiLab's "je joue aussi" copy but
/// without a numbers payload (the pick itself lives in LokiLab's feed).
model FollowedPick {
id String @id @default(cuid())
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
/// Matches LokiLab's lottery id (e.g. "lotto-max", "q4").
lotteryId String
country String
targetDrawDate String
createdAt DateTime @default(now())
@@unique([userId, lotteryId, targetDrawDate])
@@index([userId])
@@index([lotteryId, targetDrawDate])
}