- Add continuous guided light-body-scan meditation (16 segments, 97% coverage) - Edge TTS API endpoint with Xiaoxiao neural voice at -40% rate - Pre-generated chime WAVs and guidance MP3s in public/audio/ - Mute toggle in practice page, sequenced non-overlapping audio - Fix middleware to serve /audio and /api/audio/tts without auth - All LLM output localized to Chinese; fix blank home/settings pages - DeepSeek API compat: json_object, increased max_tokens - Analytics, cron reminders, onboarding flow fixes Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
142 lines
4.0 KiB
Plaintext
142 lines
4.0 KiB
Plaintext
generator client {
|
|
provider = "prisma-client"
|
|
output = "../src/generated/prisma"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "sqlite"
|
|
}
|
|
|
|
enum TaskType {
|
|
attention_training
|
|
emotion_awareness
|
|
stress_regulation
|
|
cognitive_clarity
|
|
integration
|
|
}
|
|
|
|
enum TaskStatus {
|
|
pending
|
|
completed
|
|
expired
|
|
}
|
|
|
|
enum RewardEventType {
|
|
daily_completion
|
|
streak_3
|
|
streak_7
|
|
streak_14
|
|
streak_30
|
|
stage_up
|
|
first_session
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(uuid())
|
|
email String @unique
|
|
passwordHash String? @map("password_hash")
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
|
|
state UserState? @relation("UserState")
|
|
sessions Session[]
|
|
tasks Task[]
|
|
rewardEvents RewardEvent[]
|
|
weeklySummary WeeklySummary?
|
|
|
|
@@map("users")
|
|
}
|
|
|
|
model UserState {
|
|
id String @id @default(uuid())
|
|
userId String @unique @map("user_id")
|
|
attentionLevel Int @default(50) @map("attention_level")
|
|
emotionStability Int @default(50) @map("emotion_stability")
|
|
stressLevel Int @default(50) @map("stress_level")
|
|
practiceStage Int @default(0) @map("practice_stage")
|
|
consistencyScore Int @default(0) @map("consistency_score")
|
|
streakDays Int @default(0) @map("streak_days")
|
|
totalSessionsCompleted Int @default(0) @map("total_sessions_completed")
|
|
onboardingCompleted Boolean @default(false) @map("onboarding_completed")
|
|
onboardingVariant String? @map("onboarding_variant")
|
|
timezone String @default("Asia/Shanghai")
|
|
lastSessionDate DateTime? @map("last_session_date")
|
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
|
|
user User @relation("UserState", fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@map("user_states")
|
|
}
|
|
|
|
model AnalyticsEvent {
|
|
id String @id @default(uuid())
|
|
userId String @map("user_id")
|
|
event String
|
|
metadata String @default("{}")
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
|
|
@@index([userId, createdAt])
|
|
@@index([event, createdAt])
|
|
@@map("analytics_events")
|
|
}
|
|
|
|
model Session {
|
|
id String @id @default(uuid())
|
|
userId String @map("user_id")
|
|
taskType TaskType @map("task_type")
|
|
taskDescription String @map("task_description")
|
|
durationSeconds Int @default(300) @map("duration_seconds")
|
|
completed Boolean @default(false)
|
|
focusScore Int? @map("focus_score")
|
|
emotionScore Int? @map("emotion_score")
|
|
notes String?
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([userId, createdAt])
|
|
@@map("sessions")
|
|
}
|
|
|
|
model Task {
|
|
id String @id @default(uuid())
|
|
userId String @map("user_id")
|
|
type TaskType
|
|
difficulty Int @default(1)
|
|
duration Int @default(5)
|
|
description String
|
|
reasonJson String @default("{}") @map("reason_json")
|
|
status TaskStatus @default(pending)
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([userId, createdAt])
|
|
@@index([userId, status])
|
|
@@map("tasks")
|
|
}
|
|
|
|
model RewardEvent {
|
|
id String @id @default(uuid())
|
|
userId String @map("user_id")
|
|
type RewardEventType
|
|
message String
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([userId, createdAt])
|
|
@@map("reward_events")
|
|
}
|
|
|
|
model WeeklySummary {
|
|
id String @id @default(uuid())
|
|
userId String @unique @map("user_id")
|
|
summary String?
|
|
weekStart DateTime @map("week_start")
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@map("weekly_summaries")
|
|
}
|