- Rename Entry→Event throughout frontend and backend - Change 'journal' terminology to 'diary page' - Add professional footer with links - Redirect to diary page after generation - Error handling for generation failures - Fix settings to store per-provider configs in providerSettings - Backend reads API key from providerSettings - Use prisma db push instead of migrate for schema sync - Clean up duplicate entries.ts file
105 lines
3.2 KiB
Plaintext
105 lines
3.2 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "sqlite"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(uuid())
|
|
email String @unique
|
|
passwordHash String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
apiKeys ApiKey[]
|
|
events Event[]
|
|
journals Journal[]
|
|
tasks Task[]
|
|
settings Settings?
|
|
}
|
|
|
|
model ApiKey {
|
|
id String @id @default(uuid())
|
|
userId String
|
|
keyHash String @unique
|
|
name String
|
|
lastUsedAt DateTime?
|
|
createdAt DateTime @default(now())
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([userId])
|
|
}
|
|
|
|
model Event {
|
|
id String @id @default(uuid())
|
|
userId String
|
|
date String
|
|
type String
|
|
content String
|
|
mediaPath String?
|
|
metadata String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([userId, date])
|
|
@@index([date])
|
|
}
|
|
|
|
model Journal {
|
|
id String @id @default(uuid())
|
|
userId String
|
|
date String
|
|
content String
|
|
eventCount Int
|
|
generatedAt DateTime @default(now())
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
tasks Task[]
|
|
|
|
@@unique([userId, date])
|
|
@@index([userId])
|
|
}
|
|
|
|
model Task {
|
|
id String @id @default(uuid())
|
|
userId String
|
|
journalId String
|
|
type String @default("journal_generate")
|
|
status String @default("pending")
|
|
provider String
|
|
model String?
|
|
prompt String
|
|
request String?
|
|
response String?
|
|
error String?
|
|
createdAt DateTime @default(now())
|
|
completedAt DateTime?
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
journal Journal @relation(fields: [journalId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([userId])
|
|
@@index([journalId])
|
|
}
|
|
|
|
model Settings {
|
|
userId String @id
|
|
aiProvider String @default("groq")
|
|
aiApiKey String?
|
|
aiModel String @default("llama-3.3-70b-versatile")
|
|
aiBaseUrl String?
|
|
journalPrompt String @default("You are a factual diary summarizer. Your ONLY job is to summarize the entries provided to you - nothing more.\n\nCRITICAL RULES:\n1. ONLY use information explicitly stated in the entries below\n2. NEVER invent, assume, or hallucinate any detail not in the entries\n3. NEVER add activities, emotions, weather, or context not directly mentioned\n4. If something is unclear in the entries, simply state what IS clear\n5. Keep the summary grounded and factual - no embellishment\n6. Do not write in an overly creative or story-telling style\n7. Only reference what the user explicitly recorded\n\nStructure:\n- Start with what was recorded (meetings, tasks, activities)\n- Note any explicit feelings or observations mentioned\n- Keep it concise and factual\n- If there are gaps in the day, acknowledge only what was recorded")
|
|
language String @default("en")
|
|
timezone String @default("UTC")
|
|
providerSettings String?
|
|
journalContextDays Int @default(10)
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
}
|