feat: terminology fix (Entry→Event), diary page generation, settings refactor

- 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
This commit is contained in:
lotherk
2026-03-26 23:10:33 +00:00
parent 754fea73c6
commit deaf496a7d
18 changed files with 289 additions and 256 deletions

View File

@@ -19,10 +19,10 @@ CREATE TABLE IF NOT EXISTS "ApiKey" (
CONSTRAINT "ApiKey_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE INDEX IF NOT EXISTS "ApiKey_userId_key" ON "ApiKey"("userId");
CREATE UNIQUE INDEX IF NOT EXISTS "ApiKey_keyHash_key" ON "ApiKey"("keyHash");
CREATE INDEX IF NOT EXISTS "ApiKey_userId_key" ON "ApiKey"("userId");
CREATE TABLE IF NOT EXISTS "Entry" (
CREATE TABLE IF NOT EXISTS "Event" (
"id" TEXT NOT NULL PRIMARY KEY,
"userId" TEXT NOT NULL,
"date" TEXT NOT NULL,
@@ -32,18 +32,18 @@ CREATE TABLE IF NOT EXISTS "Entry" (
"metadata" TEXT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "Entry_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
CONSTRAINT "Event_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE INDEX IF NOT EXISTS "Entry_userId_date_key" ON "Entry"("userId", "date");
CREATE INDEX IF NOT EXISTS "Entry_date_key" ON "Entry"("date");
CREATE INDEX IF NOT EXISTS "Event_userId_date_key" ON "Event"("userId", "date");
CREATE INDEX IF NOT EXISTS "Event_date_key" ON "Event"("date");
CREATE TABLE IF NOT EXISTS "Journal" (
"id" TEXT NOT NULL PRIMARY KEY,
"userId" TEXT NOT NULL,
"date" TEXT NOT NULL,
"content" TEXT NOT NULL,
"entryCount" INTEGER NOT NULL,
"eventCount" INTEGER NOT NULL,
"generatedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "Journal_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
@@ -86,7 +86,6 @@ CREATE TABLE IF NOT EXISTS "Settings" (
CONSTRAINT "Settings_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
-- Create _prisma_migrations table for Prisma migrate tracking
CREATE TABLE IF NOT EXISTS "_prisma_migrations" (
"id" TEXT NOT NULL PRIMARY KEY,
"checksum" TEXT NOT NULL,
@@ -98,6 +97,5 @@ CREATE TABLE IF NOT EXISTS "_prisma_migrations" (
"applied_steps_count" INTEGER NOT NULL DEFAULT 0
);
-- Record this migration
INSERT INTO "_prisma_migrations" ("id", "checksum", "finished_at", "migration_name", "applied_steps_count")
VALUES (lower(hex(randomblob(16))), 'init', datetime('now'), '00000000000000_init', 1);

View File

@@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (e.g., Git)
provider = "sqlite"

View File

@@ -15,7 +15,7 @@ model User {
updatedAt DateTime @updatedAt
apiKeys ApiKey[]
entries Entry[]
events Event[]
journals Journal[]
tasks Task[]
settings Settings?
@@ -34,7 +34,7 @@ model ApiKey {
@@index([userId])
}
model Entry {
model Event {
id String @id @default(uuid())
userId String
date String
@@ -56,7 +56,7 @@ model Journal {
userId String
date String
content String
entryCount Int
eventCount Int
generatedAt DateTime @default(now())
user User @relation(fields: [userId], references: [id], onDelete: Cascade)