My-Weekly-ToDo-List/prisma/schema.prisma
mARTin 163e9c1a07 feat: major update — mobile fix, auth decoupling, CalDAV perf, projects, fonts, quotes
Mobile fixes:
- Add viewport meta tag (was missing, causing broken mobile rendering)
- Make header nav controls visible on mobile (opacity-0 group-hover was invisible on touch)
- Add touch swipe gestures for day navigation on mobile
- Fix viewDays responsive override after profile load

Bug fixes:
- Fix goal save (WeeklyView used POST but route only had GET/PUT; fix to use PUT, add POST alias)
- Fix body key mismatch (goal → text) in goal save request

Auth & identity (Task 1):
- Add accountNumber (auto-increment) to User model for stable identity
- Fix OAuth flows: pass user CUID in state instead of email
- Google/Outlook callbacks now look up users by ID, not email
- Non-Gmail users can now connect Google Calendar/Tasks

CalDAV performance (Task 5):
- Embed CalDAV object URL in Apple event IDs (caldav::<url>::<uid> format)
- Delete/update now use O(1) direct URL access instead of O(n) full calendar scan
- Optimistic UI removal on delete (no blocking force-refresh)
- Legacy fallback for old-format IDs during transition

Apple Calendar data (Task 2):
- Pass URL, location, recurringEventId, isRecurring through full pipeline
- Add url, recurringEventId, isRecurring to CachedCalendarEvent schema
- Calendar cache now reads/writes all new fields

Projects (Task 6):
- New Project model (name, icon, color, description, order)
- CRUD API at /api/tasks/projects
- Tasks now support optional projectId with cascading nullify

Quotes (Task 4):
- Curated local quote database (50 quotes, DE+EN) with tag filtering
- Preset quote source APIs (ZenQuotes, Quotable, Forismatic, Type.fit)

Fonts (Task 7):
- FontPicker component with searchable dropdown and live preview
- /api/fonts endpoint (Google Fonts API proxy with 24h cache, fallback to 40 popular fonts)

Quick Settings (Task 8):
- QuickSettingsSidebar component (font size, spacing, show completed, start day, show lines)
- New user preferences: showCompletedTasks, showLines, startDayOffset, quoteSourceUrls

v1.9.0

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 17:55:49 +01:00

275 lines
11 KiB
Plaintext

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
}
model User {
id String @id @default(cuid())
accountNumber Int @unique @default(autoincrement())
email String @unique
passwordHash String?
name String?
image String?
emailVerified DateTime?
verifiedAt DateTime?
emailVerificationToken String?
emailVerificationExpires DateTime?
passwordResetToken String?
passwordResetExpires DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
timezone String @default("UTC")
autoRolling Boolean @default(false)
protectEventTimes Boolean @default(false)
language String @default("de")
dateFormat String @default("yyyy-MM-dd")
timeFormat String @default("24h")
startHour Int @default(8)
endHour Int @default(18)
showNextTask Boolean @default(false)
calendarEditMode Boolean @default(false)
focusTimerDuration Int @default(25)
focusBreakDuration Int @default(5)
showTimeGrid Boolean @default(true)
showSomeday Boolean @default(true)
showAllDayEvents Boolean @default(true)
showSchedule Boolean @default(true)
cellDuration Int @default(30)
viewStyle String @default("simple")
viewDays Int @default(7)
fontSize String @default("M")
goalFallbackType String @default("quote")
goalDefaultSentence String @default("goal of the week")
goalFontFamily String? @default("Lato")
goalFontSize String? @default("1rem")
goalFontWeight String? @default("500")
headlineFont String @default("Oswald")
headlineFontSize String? @default("1.5rem")
headlineFontWeight String? @default("900")
dateFontFamily String? @default("Inter")
dateFontSize String? @default("0.65rem")
dateFontWeight String? @default("400")
timeTaskFontFamily String? @default("Inter")
timeTaskFontSize String? @default("0.75rem")
timeTaskFontWeight String? @default("500")
bodyFont String @default("Inter")
taskFontFamily String? @default("Inter")
taskFontSize String? @default("0.9rem")
taskFontWeight String? @default("400")
eventFontFamily String? @default("Inter")
eventFontSize String? @default("0.85rem")
eventFontWeight String? @default("400")
fontWeight String @default("400")
weekdayColor String? @default("#0ea5e9")
dateColor String? @default("#888888")
taskColor String? @default("#333333")
todayHighlightColor String? @default("#f0fafa")
weekendColorSat String? @default("#ffc107")
weekendColorSun String? @default("#dc2626")
pastDayColor String? @default("#a6a6a7")
goalScope String @default("week")
dateLayout String @default("right")
dateAlignment String @default("center")
hourLabelFormat String @default("short")
showSubHourSlots Boolean @default(true)
dayHeaderGap String? @default("0.75em")
allDayPosition String @default("above")
cwColor String? @default("#333333")
cwFontFamily String? @default("Oswald")
cwFontSize String? @default("1.5rem")
cwFontWeight String? @default("700")
yearColor String? @default("#333333")
yearFontFamily String? @default("Oswald")
yearFontSize String? @default("1.5rem")
yearFontWeight String? @default("700")
showTaskCheckboxes Boolean @default(false)
showCompletedTasks Boolean @default(true)
showLines Boolean @default(true)
startDayOffset Int @default(-1)
quoteSourceUrls String[] @default([])
emailVerificationCode String?
accounts Account[]
projects Project[]
cachedCalendarEvents CachedCalendarEvent[]
calendarConnections CalendarConnection[]
sessions Session[]
somedayLists SomedayList[]
tasks Task[]
weeklyGoals WeeklyGoal[]
}
model Account {
id String @id @default(cuid())
userId String
type String
provider String
providerAccountId String
refresh_token String?
access_token String?
expires_at Int?
token_type String?
scope String?
id_token String?
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])
}
model Task {
id String @id @default(cuid())
userId String
title String
description String?
markdownContent String?
completed Boolean @default(false)
isRolling Boolean @default(false)
order Int @default(0)
dayOfWeek Int?
scheduledDate DateTime?
somedayListId String?
originalDate DateTime?
startTime String?
endTime String?
isRecurring Boolean @default(false)
recurrenceInterval Int?
recurrenceUnit String?
recurrenceTime String?
recurrenceEndDate DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
externalId String?
externalProvider String?
externalListId String?
lastSyncedAt DateTime?
deletedAt DateTime?
parentTaskId String?
projectId String?
somedaySlotIndex Int?
parent Task? @relation("SubTasks", fields: [parentTaskId], references: [id], onDelete: Cascade)
subTasks Task[] @relation("SubTasks")
somedayList SomedayList? @relation(fields: [somedayListId], references: [id])
project Project? @relation(fields: [projectId], references: [id], onDelete: SetNull)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@index([userId, dayOfWeek])
@@index([userId, scheduledDate])
@@index([userId, somedayListId])
@@index([userId, externalId])
@@index([userId, deletedAt])
@@index([userId, projectId])
@@index([parentTaskId])
}
model SomedayList {
id String @id @default(cuid())
userId String
title String
order Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
externalId String?
externalProvider String?
lastSyncedAt DateTime?
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
tasks Task[]
@@index([userId])
}
model CalendarConnection {
id String @id @default(cuid())
userId String
provider String
accessToken String
refreshToken String?
expiresAt DateTime?
calendars Json?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
cachedEvents CachedCalendarEvent[]
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}
model CachedCalendarEvent {
id String @id @default(cuid())
userId String
externalId String
connectionId String
provider String
calendarId String
calendarTitle String
calendarColor String?
title String
description String?
location String?
url String?
recurringEventId String?
isRecurring Boolean @default(false)
startDateTime DateTime?
startDate String?
endDateTime DateTime?
endDate String?
weekStart DateTime
syncedAt DateTime @default(now())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
connection CalendarConnection @relation(fields: [connectionId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([userId, externalId, provider])
@@index([userId, startDateTime])
@@index([userId, startDate])
@@index([connectionId, weekStart])
}
model WeeklyGoal {
id String @id @default(cuid())
userId String
weekStart DateTime
text String @default("your goal of this week")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([userId, weekStart])
@@index([userId])
}
model Project {
id String @id @default(cuid())
userId String
name String
icon String?
color String?
description String?
order Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
tasks Task[]
@@index([userId])
}