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",
"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": {

View File

@ -25,7 +25,6 @@ model User {
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")
@ -81,9 +80,6 @@ model User {
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")
@ -96,6 +92,8 @@ model User {
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())
@ -109,25 +107,29 @@ model User {
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[]
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[]
}
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])
@ -325,7 +326,7 @@ model CalendarSyncRule {
userId String
name String @default("")
enabled Boolean @default(true)
direction String @default("one-way") // "one-way" (source→target)
direction String @default("one-way")
sourceConnectionId String
sourceCalendarId String
targetConnectionId String

View File

@ -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,