Some checks failed
Deploy / deploy (push) Failing after 50s
- Implemented a new HomePage component displaying the leaderboard. - Created Providers component for session management using next-auth. - Developed Header component for navigation and user authentication. - Added Leaderboard component to fetch and display sleep data. - Introduced SleepCard component for individual sleep entries. - Created SleepForm component for logging sleep data with manual input options. - Added SleepPhaseBar component to visualize sleep phases. - Implemented utility functions for formatting and calculating sleep data. - Set up authentication with Discord using next-auth and Prisma. - Configured middleware for protected routes. - Added TypeScript definitions for next-auth session. - Configured Tailwind CSS for styling. - Initialized TypeScript configuration for the project.
90 lines
2.0 KiB
Plaintext
90 lines
2.0 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
// --- NextAuth required models ---
|
|
|
|
model Account {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
type String
|
|
provider String
|
|
providerAccountId String
|
|
refresh_token String? @db.Text
|
|
access_token String? @db.Text
|
|
expires_at Int?
|
|
token_type String?
|
|
scope String?
|
|
id_token String? @db.Text
|
|
session_state String?
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([provider, providerAccountId])
|
|
}
|
|
|
|
model Session {
|
|
id String @id @default(cuid())
|
|
sessionToken String @unique
|
|
userId String
|
|
expires DateTime
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
}
|
|
|
|
model VerificationToken {
|
|
identifier String
|
|
token String @unique
|
|
expires DateTime
|
|
|
|
@@unique([identifier, token])
|
|
}
|
|
|
|
// --- App models ---
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
name String?
|
|
email String? @unique
|
|
emailVerified DateTime?
|
|
image String?
|
|
accounts Account[]
|
|
sessions Session[]
|
|
sleepEntries SleepEntry[]
|
|
createdAt DateTime @default(now())
|
|
}
|
|
|
|
model SleepEntry {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
// The date of the night (e.g. 2024-01-15 = night of 14→15 jan)
|
|
date DateTime @db.Date
|
|
|
|
// Optional: exact times
|
|
bedtime DateTime?
|
|
wakeTime DateTime?
|
|
|
|
// Required: total sleep
|
|
totalMinutes Int
|
|
|
|
// Optional: phase breakdown (in minutes)
|
|
deepMinutes Int?
|
|
lightMinutes Int?
|
|
remMinutes Int?
|
|
awakeMinutes Int?
|
|
awakeCount Int?
|
|
|
|
notes String?
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@unique([userId, date])
|
|
}
|