feat: enhance user preferences management with userId integration
- Added `userId` field to `UserPreferences` model in Prisma schema for user-specific preferences. - Implemented migration to populate existing preferences with the first user. - Updated user preferences service methods to handle user-specific data retrieval and updates. - Modified API routes and components to ensure user authentication and fetch preferences based on the authenticated user. - Enhanced session management in various components to load user preferences accordingly.
This commit is contained in:
@@ -20,6 +20,7 @@ model User {
|
||||
password String // Hashé avec bcrypt
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
preferences UserPreferences?
|
||||
|
||||
@@map("users")
|
||||
}
|
||||
@@ -101,6 +102,7 @@ model DailyCheckbox {
|
||||
|
||||
model UserPreferences {
|
||||
id String @id @default(cuid())
|
||||
userId String @unique
|
||||
kanbanFilters Json?
|
||||
viewPreferences Json?
|
||||
columnVisibility Json?
|
||||
@@ -112,6 +114,7 @@ model UserPreferences {
|
||||
tfsSyncInterval String @default("daily")
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("user_preferences")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user