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
This commit is contained in:
mARTin 2026-04-02 10:15:49 +02:00
parent 676c5612ed
commit b7954f9367
3 changed files with 159 additions and 152 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "my-weekly-todo-list", "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", "description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -25,7 +25,6 @@ model User {
timezone String @default("UTC") timezone String @default("UTC")
autoRolling Boolean @default(false) autoRolling Boolean @default(false)
protectEventTimes Boolean @default(false) protectEventTimes Boolean @default(false)
showCalendarProviderIcon Boolean @default(false)
language String @default("de") language String @default("de")
dateFormat String @default("yyyy-MM-dd") dateFormat String @default("yyyy-MM-dd")
timeFormat String @default("24h") timeFormat String @default("24h")
@ -81,9 +80,6 @@ model User {
dateVerticalAlign String? @default("middle") dateVerticalAlign String? @default("middle")
headerDisplay String? @default("kw") headerDisplay String? @default("kw")
headerCustomFormat String? @default("KW WW | YYYY") 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") hourLabelFormat String @default("short")
showSubHourSlots Boolean @default(true) showSubHourSlots Boolean @default(true)
allDayPosition String @default("above") allDayPosition String @default("above")
@ -96,6 +92,8 @@ model User {
yearFontSize String? @default("1.5rem") yearFontSize String? @default("1.5rem")
yearFontWeight String? @default("700") yearFontWeight String? @default("700")
showTaskCheckboxes Boolean @default(false) showTaskCheckboxes Boolean @default(false)
showProjectIcons Boolean @default(false)
weekStartDay Int @default(1)
emailVerificationCode String? emailVerificationCode String?
dayHeaderGap String? @default("0.75em") dayHeaderGap String? @default("0.75em")
accountNumber Int @unique @default(autoincrement()) accountNumber Int @unique @default(autoincrement())
@ -109,25 +107,29 @@ model User {
quoteSourceUrls String[] @default([]) quoteSourceUrls String[] @default([])
quoteLanguages String[] @default(["en", "de"]) quoteLanguages String[] @default(["en", "de"])
kanbanStages String? kanbanStages String?
notificationsEnabled Boolean @default(false)
weatherEnabled Boolean @default(false)
weatherLat Float?
weatherLocation String?
weatherLon Float?
viewSettings Json? 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[] accounts Account[]
cachedCalendarEvents CachedCalendarEvent[] cachedCalendarEvents CachedCalendarEvent[]
calendarConnections CalendarConnection[] calendarConnections CalendarConnection[]
calendarSyncRules CalendarSyncRule[] calendarSyncRules CalendarSyncRule[]
projects Project[] projects Project[]
pushSubscriptions PushSubscription[]
sentNotifications SentNotification[]
sessions Session[] sessions Session[]
weatherEnabled Boolean @default(false)
weatherLat Float?
weatherLon Float?
weatherLocation String?
weatherRecentCities Json?
hasCompletedOnboarding Boolean @default(true)
notificationsEnabled Boolean @default(false)
somedayLists SomedayList[] somedayLists SomedayList[]
tasks Task[] tasks Task[]
weeklyGoals WeeklyGoal[] weeklyGoals WeeklyGoal[]
pushSubscriptions PushSubscription[]
sentNotifications SentNotification[]
} }
model Account { model Account {
@ -266,11 +268,10 @@ model CachedCalendarEvent {
url String? url String?
recurringEventId String? recurringEventId String?
isRecurring Boolean @default(false) isRecurring Boolean @default(false)
reminders Json?
connection CalendarConnection @relation(fields: [connectionId], references: [id], onDelete: Cascade) connection CalendarConnection @relation(fields: [connectionId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade) user User @relation(fields: [userId], references: [id], onDelete: Cascade)
reminders Json?
@@unique([userId, externalId, provider]) @@unique([userId, externalId, provider])
@@index([userId, startDateTime]) @@index([userId, startDateTime])
@@index([userId, startDate]) @@index([userId, startDate])
@ -325,7 +326,7 @@ model CalendarSyncRule {
userId String userId String
name String @default("") name String @default("")
enabled Boolean @default(true) enabled Boolean @default(true)
direction String @default("one-way") // "one-way" (source→target) direction String @default("one-way")
sourceConnectionId String sourceConnectionId String
sourceCalendarId String sourceCalendarId String
targetConnectionId String targetConnectionId String

View File

@ -33,6 +33,7 @@ export async function GET(request: NextRequest) {
showAllDayEvents: true, showAllDayEvents: true,
showSchedule: true, showSchedule: true,
showTaskCheckboxes: true, showTaskCheckboxes: true,
showProjectIcons: true,
cellDuration: true, cellDuration: true,
viewStyle: true, viewStyle: true,
viewDays: true, viewDays: true,
@ -93,6 +94,7 @@ export async function GET(request: NextRequest) {
weekdayFormat: true, weekdayFormat: true,
weekdayCase: true, weekdayCase: true,
customWeekdayNames: true, customWeekdayNames: true,
weekStartDay: true,
quoteSourceUrls: true, quoteSourceUrls: true,
quoteLanguages: true, quoteLanguages: true,
kanbanStages: true, kanbanStages: true,
@ -148,8 +150,8 @@ export async function PATCH(request: NextRequest) {
hourLabelFormat, showSubHourSlots, allDayPosition, hourLabelFormat, showSubHourSlots, allDayPosition,
cwFontFamily, cwFontSize, cwFontWeight, cwColor, cwFontFamily, cwFontSize, cwFontWeight, cwColor,
yearFontFamily, yearFontSize, yearFontWeight, yearColor, yearFontFamily, yearFontSize, yearFontWeight, yearColor,
showTaskCheckboxes, dayHeaderGap, showTaskCheckboxes, showProjectIcons, dayHeaderGap,
showCompletedTasks, showLines, startDayOffset, weekdayFormat, weekdayCase, customWeekdayNames, quoteSourceUrls, quoteLanguages, showCompletedTasks, showLines, startDayOffset, weekdayFormat, weekdayCase, customWeekdayNames, weekStartDay, quoteSourceUrls, quoteLanguages,
kanbanStages, lightTheme, darkTheme, notificationsEnabled, mobileFontScale, kanbanStages, lightTheme, darkTheme, notificationsEnabled, mobileFontScale,
weatherEnabled, weatherLat, weatherLon, weatherLocation, weatherRecentCities, viewSettings, weatherEnabled, weatherLat, weatherLon, weatherLocation, weatherRecentCities, viewSettings,
hasCompletedOnboarding hasCompletedOnboarding
@ -175,6 +177,7 @@ export async function PATCH(request: NextRequest) {
...(showAllDayEvents !== undefined && { showAllDayEvents }), ...(showAllDayEvents !== undefined && { showAllDayEvents }),
...(showSchedule !== undefined && { showSchedule }), ...(showSchedule !== undefined && { showSchedule }),
...(showTaskCheckboxes !== undefined && { showTaskCheckboxes }), ...(showTaskCheckboxes !== undefined && { showTaskCheckboxes }),
...(showProjectIcons !== undefined && { showProjectIcons }),
...(cellDuration !== undefined && !isNaN(cellDuration) && { cellDuration }), ...(cellDuration !== undefined && !isNaN(cellDuration) && { cellDuration }),
...(viewStyle !== undefined && { viewStyle }), ...(viewStyle !== undefined && { viewStyle }),
...(viewDays !== undefined && !isNaN(viewDays) && { viewDays }), ...(viewDays !== undefined && !isNaN(viewDays) && { viewDays }),
@ -235,6 +238,7 @@ export async function PATCH(request: NextRequest) {
...(weekdayFormat !== undefined && { weekdayFormat }), ...(weekdayFormat !== undefined && { weekdayFormat }),
...(weekdayCase !== undefined && { weekdayCase }), ...(weekdayCase !== undefined && { weekdayCase }),
...(customWeekdayNames !== undefined && { customWeekdayNames }), ...(customWeekdayNames !== undefined && { customWeekdayNames }),
...(weekStartDay !== undefined && { weekStartDay }),
...(quoteSourceUrls !== undefined && { quoteSourceUrls }), ...(quoteSourceUrls !== undefined && { quoteSourceUrls }),
...(quoteLanguages !== undefined && { quoteLanguages }), ...(quoteLanguages !== undefined && { quoteLanguages }),
...(kanbanStages !== undefined && { kanbanStages }), ...(kanbanStages !== undefined && { kanbanStages }),
@ -278,6 +282,7 @@ export async function PATCH(request: NextRequest) {
showAllDayEvents: true, showAllDayEvents: true,
showSchedule: true, showSchedule: true,
showTaskCheckboxes: true, showTaskCheckboxes: true,
showProjectIcons: true,
cellDuration: true, cellDuration: true,
viewStyle: true, viewStyle: true,
viewDays: true, viewDays: true,
@ -338,6 +343,7 @@ export async function PATCH(request: NextRequest) {
weekdayFormat: true, weekdayFormat: true,
weekdayCase: true, weekdayCase: true,
customWeekdayNames: true, customWeekdayNames: true,
weekStartDay: true,
quoteSourceUrls: true, quoteSourceUrls: true,
quoteLanguages: true, quoteLanguages: true,
kanbanStages: true, kanbanStages: true,