Features: - User authentication via WorkOS (Apple, Google, Phone) - Daily check-in dialog for usage tracking - Calendar view with usage heatmap - Personalized reduction plan generator after 7 days of tracking - Custom OKLCH color theme with DM Sans and Space Mono fonts Tech stack: - Next.js 15 with App Router - Shadcn/UI components - Prisma with SQLite database - Tailwind CSS v4 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
54 lines
1.4 KiB
Plaintext
54 lines
1.4 KiB
Plaintext
// This is your Prisma schema file,
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "sqlite"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
workosId String @unique
|
|
email String?
|
|
phone String?
|
|
name String?
|
|
substanceType String @default("nicotine") // "nicotine" | "weed"
|
|
stayLoggedIn Boolean @default(false)
|
|
onboardingComplete Boolean @default(false)
|
|
lastCheckIn DateTime?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
usageLogs UsageLog[]
|
|
plans ReductionPlan[]
|
|
}
|
|
|
|
model UsageLog {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
date DateTime
|
|
puffs Int
|
|
notes String?
|
|
createdAt DateTime @default(now())
|
|
|
|
@@index([userId, date])
|
|
}
|
|
|
|
model ReductionPlan {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
weekNumber Int
|
|
dailyTarget Int
|
|
startDate DateTime
|
|
endDate DateTime
|
|
isActive Boolean @default(true)
|
|
createdAt DateTime @default(now())
|
|
|
|
@@index([userId])
|
|
}
|