From b7954f9367fdb552902a548e2b1387fbc22fad52 Mon Sep 17 00:00:00 2001 From: mARTin Date: Thu, 2 Apr 2026 10:15:49 +0200 Subject: [PATCH] fix: add showProjectIcons and weekStartDay to Prisma schema + route Both fields existed in the DB but were missing from schema.prisma, so the Prisma client didn't know about them. The client has been regenerated (prisma db push). Added both fields to: - prisma/schema.prisma (with correct defaults) - GET select, PATCH destructure, updateData, PATCH select in route.ts This resolves the 500 errors on PATCH /api/user/profile that occurred when saveSetting() tried to persist these fields. v1.81.8 --- package.json | 2 +- prisma/schema.prisma | 299 +++++++++++++++--------------- src/app/api/user/profile/route.ts | 10 +- 3 files changed, 159 insertions(+), 152 deletions(-) diff --git a/package.json b/package.json index 50037c9..dc5891d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "my-weekly-todo-list", - "version": "1.81.7", + "version": "1.81.8", "description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view", "main": "index.js", "scripts": { diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 76fb73e..c54d830 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -9,125 +9,127 @@ datasource db { } model User { - id String @id @default(cuid()) - 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) - showCalendarProviderIcon 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") - lightTheme Json? - darkTheme Json? - 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") - mobileDateLayout String @default("below") - dateAlignment String @default("center") - dateVerticalAlign String? @default("middle") - headerDisplay String? @default("kw") - headerCustomFormat String? @default("KW WW | YYYY") - headerCurrentDayFormat String? @default("DDD, DD. MMMM YYYY") - mobilePortraitHeaderDisplay String? @default("current_day") - mobileLandscapeHeaderDisplay String? @default("kw") - hourLabelFormat String @default("short") - showSubHourSlots Boolean @default(true) - 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) - emailVerificationCode String? - dayHeaderGap String? @default("0.75em") - accountNumber Int @unique @default(autoincrement()) - showCompletedTasks Boolean @default(true) - showLines Boolean @default(true) - weekdayFormat String? @default("long") - weekdayCase String? @default("capitalize") - customWeekdayNames String? @default("") - mobileFontScale Float @default(1.0) - startDayOffset Int @default(-1) - quoteSourceUrls String[] @default([]) - quoteLanguages String[] @default(["en", "de"]) - kanbanStages String? - viewSettings Json? - accounts Account[] - cachedCalendarEvents CachedCalendarEvent[] - calendarConnections CalendarConnection[] - calendarSyncRules CalendarSyncRule[] - projects Project[] - sessions Session[] - weatherEnabled Boolean @default(false) - weatherLat Float? - weatherLon Float? - weatherLocation String? - weatherRecentCities Json? - hasCompletedOnboarding Boolean @default(true) - notificationsEnabled Boolean @default(false) - somedayLists SomedayList[] - tasks Task[] - weeklyGoals WeeklyGoal[] - pushSubscriptions PushSubscription[] - sentNotifications SentNotification[] + id String @id @default(cuid()) + 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") + lightTheme Json? + darkTheme Json? + 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") + mobileDateLayout String @default("below") + dateAlignment String @default("center") + dateVerticalAlign String? @default("middle") + headerDisplay String? @default("kw") + headerCustomFormat String? @default("KW WW | YYYY") + hourLabelFormat String @default("short") + showSubHourSlots Boolean @default(true) + 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) + showProjectIcons Boolean @default(false) + weekStartDay Int @default(1) + emailVerificationCode String? + dayHeaderGap String? @default("0.75em") + accountNumber Int @unique @default(autoincrement()) + showCompletedTasks Boolean @default(true) + showLines Boolean @default(true) + weekdayFormat String? @default("long") + weekdayCase String? @default("capitalize") + customWeekdayNames String? @default("") + mobileFontScale Float @default(1.0) + startDayOffset Int @default(-1) + quoteSourceUrls String[] @default([]) + quoteLanguages String[] @default(["en", "de"]) + kanbanStages String? + notificationsEnabled Boolean @default(false) + weatherEnabled Boolean @default(false) + weatherLat Float? + weatherLocation String? + weatherLon Float? + viewSettings Json? + weatherRecentCities Json? + hasCompletedOnboarding Boolean @default(true) + showCalendarProviderIcon Boolean @default(false) + headerCurrentDayFormat String? @default("DDD, DD. MMMM YYYY") + mobileLandscapeHeaderDisplay String? @default("kw") + mobilePortraitHeaderDisplay String? @default("current_day") + accounts Account[] + cachedCalendarEvents CachedCalendarEvent[] + calendarConnections CalendarConnection[] + calendarSyncRules CalendarSyncRule[] + projects Project[] + pushSubscriptions PushSubscription[] + sentNotifications SentNotification[] + sessions Session[] + somedayLists SomedayList[] + tasks Task[] + weeklyGoals WeeklyGoal[] } model Account { @@ -266,11 +268,10 @@ model CachedCalendarEvent { url String? recurringEventId String? isRecurring Boolean @default(false) + reminders Json? connection CalendarConnection @relation(fields: [connectionId], references: [id], onDelete: Cascade) user User @relation(fields: [userId], references: [id], onDelete: Cascade) - reminders Json? - @@unique([userId, externalId, provider]) @@index([userId, startDateTime]) @@index([userId, startDate]) @@ -321,40 +322,40 @@ model PushSubscription { } model CalendarSyncRule { - id String @id @default(cuid()) + id String @id @default(cuid()) userId String - name String @default("") - enabled Boolean @default(true) - direction String @default("one-way") // "one-way" (source→target) + name String @default("") + enabled Boolean @default(true) + direction String @default("one-way") sourceConnectionId String sourceCalendarId String targetConnectionId String targetCalendarId String - syncDescription Boolean @default(true) - syncLocation Boolean @default(true) - syncRecurring Boolean @default(false) - titlePrefix String @default("") - createdAt DateTime @default(now()) - updatedAt DateTime @updatedAt + syncDescription Boolean @default(true) + syncLocation Boolean @default(true) + syncRecurring Boolean @default(false) + titlePrefix String @default("") + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt lastSyncedAt DateTime? mappings CalendarSyncMapping[] - user User @relation(fields: [userId], references: [id], onDelete: Cascade) + user User @relation(fields: [userId], references: [id], onDelete: Cascade) @@index([userId]) } model CalendarSyncMapping { - id String @id @default(cuid()) - ruleId String - userId String - sourceEventId String - sourceProvider String - targetEventId String - targetProvider String - targetCalendarId String - sourceFingerprint String - lastSyncedAt DateTime @default(now()) - rule CalendarSyncRule @relation(fields: [ruleId], references: [id], onDelete: Cascade) + id String @id @default(cuid()) + ruleId String + userId String + sourceEventId String + sourceProvider String + targetEventId String + targetProvider String + targetCalendarId String + sourceFingerprint String + lastSyncedAt DateTime @default(now()) + rule CalendarSyncRule @relation(fields: [ruleId], references: [id], onDelete: Cascade) @@unique([ruleId, sourceEventId]) @@index([userId, targetEventId, targetProvider]) @@ -362,12 +363,12 @@ model CalendarSyncMapping { } model SentNotification { - id String @id @default(cuid()) - userId String - eventId String - minutes Int - sentAt DateTime @default(now()) - user User @relation(fields: [userId], references: [id], onDelete: Cascade) + id String @id @default(cuid()) + userId String + eventId String + minutes Int + sentAt DateTime @default(now()) + user User @relation(fields: [userId], references: [id], onDelete: Cascade) @@unique([userId, eventId, minutes]) @@index([sentAt]) diff --git a/src/app/api/user/profile/route.ts b/src/app/api/user/profile/route.ts index 4f9b142..7611a6b 100644 --- a/src/app/api/user/profile/route.ts +++ b/src/app/api/user/profile/route.ts @@ -33,6 +33,7 @@ export async function GET(request: NextRequest) { showAllDayEvents: true, showSchedule: true, showTaskCheckboxes: true, + showProjectIcons: true, cellDuration: true, viewStyle: true, viewDays: true, @@ -93,6 +94,7 @@ export async function GET(request: NextRequest) { weekdayFormat: true, weekdayCase: true, customWeekdayNames: true, + weekStartDay: true, quoteSourceUrls: true, quoteLanguages: true, kanbanStages: true, @@ -148,8 +150,8 @@ export async function PATCH(request: NextRequest) { hourLabelFormat, showSubHourSlots, allDayPosition, cwFontFamily, cwFontSize, cwFontWeight, cwColor, yearFontFamily, yearFontSize, yearFontWeight, yearColor, - showTaskCheckboxes, dayHeaderGap, - showCompletedTasks, showLines, startDayOffset, weekdayFormat, weekdayCase, customWeekdayNames, quoteSourceUrls, quoteLanguages, + showTaskCheckboxes, showProjectIcons, dayHeaderGap, + showCompletedTasks, showLines, startDayOffset, weekdayFormat, weekdayCase, customWeekdayNames, weekStartDay, quoteSourceUrls, quoteLanguages, kanbanStages, lightTheme, darkTheme, notificationsEnabled, mobileFontScale, weatherEnabled, weatherLat, weatherLon, weatherLocation, weatherRecentCities, viewSettings, hasCompletedOnboarding @@ -175,6 +177,7 @@ export async function PATCH(request: NextRequest) { ...(showAllDayEvents !== undefined && { showAllDayEvents }), ...(showSchedule !== undefined && { showSchedule }), ...(showTaskCheckboxes !== undefined && { showTaskCheckboxes }), + ...(showProjectIcons !== undefined && { showProjectIcons }), ...(cellDuration !== undefined && !isNaN(cellDuration) && { cellDuration }), ...(viewStyle !== undefined && { viewStyle }), ...(viewDays !== undefined && !isNaN(viewDays) && { viewDays }), @@ -235,6 +238,7 @@ export async function PATCH(request: NextRequest) { ...(weekdayFormat !== undefined && { weekdayFormat }), ...(weekdayCase !== undefined && { weekdayCase }), ...(customWeekdayNames !== undefined && { customWeekdayNames }), + ...(weekStartDay !== undefined && { weekStartDay }), ...(quoteSourceUrls !== undefined && { quoteSourceUrls }), ...(quoteLanguages !== undefined && { quoteLanguages }), ...(kanbanStages !== undefined && { kanbanStages }), @@ -278,6 +282,7 @@ export async function PATCH(request: NextRequest) { showAllDayEvents: true, showSchedule: true, showTaskCheckboxes: true, + showProjectIcons: true, cellDuration: true, viewStyle: true, viewDays: true, @@ -338,6 +343,7 @@ export async function PATCH(request: NextRequest) { weekdayFormat: true, weekdayCase: true, customWeekdayNames: true, + weekStartDay: true, quoteSourceUrls: true, quoteLanguages: true, kanbanStages: true,