- Added userId field to DailyCheckbox model for user association. - Updated DailyService methods to handle user-specific checkbox retrieval and management. - Integrated user authentication checks in API routes and actions for secure access to daily data. - Enhanced DailyPage to display user-specific daily views, ensuring proper session handling. - Updated client and service interfaces to reflect changes in data structure.
154 lines
4.3 KiB
Plaintext
154 lines
4.3 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "sqlite"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
email String @unique
|
|
name String?
|
|
firstName String?
|
|
lastName String?
|
|
avatar String? // URL de l'avatar
|
|
role String @default("user") // user, admin, etc.
|
|
isActive Boolean @default(true)
|
|
lastLoginAt DateTime?
|
|
password String // Hashé avec bcrypt
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
preferences UserPreferences?
|
|
notes Note[]
|
|
dailyCheckboxes DailyCheckbox[]
|
|
|
|
@@map("users")
|
|
}
|
|
|
|
model Task {
|
|
id String @id @default(cuid())
|
|
title String
|
|
description String?
|
|
status String @default("todo")
|
|
priority String @default("medium")
|
|
source String
|
|
sourceId String?
|
|
dueDate DateTime?
|
|
completedAt DateTime?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
jiraProject String?
|
|
jiraKey String?
|
|
assignee String?
|
|
jiraType String?
|
|
tfsProject String?
|
|
tfsPullRequestId Int?
|
|
tfsRepository String?
|
|
tfsSourceBranch String?
|
|
tfsTargetBranch String?
|
|
primaryTagId String?
|
|
primaryTag Tag? @relation("PrimaryTag", fields: [primaryTagId], references: [id])
|
|
dailyCheckboxes DailyCheckbox[]
|
|
taskTags TaskTag[]
|
|
notes Note[] // Notes associées à cette tâche
|
|
|
|
@@unique([source, sourceId])
|
|
@@map("tasks")
|
|
}
|
|
|
|
model Tag {
|
|
id String @id @default(cuid())
|
|
name String @unique
|
|
color String @default("#6b7280")
|
|
isPinned Boolean @default(false)
|
|
taskTags TaskTag[]
|
|
primaryTasks Task[] @relation("PrimaryTag")
|
|
noteTags NoteTag[]
|
|
|
|
@@map("tags")
|
|
}
|
|
|
|
model TaskTag {
|
|
taskId String
|
|
tagId String
|
|
tag Tag @relation(fields: [tagId], references: [id], onDelete: Cascade)
|
|
task Task @relation(fields: [taskId], references: [id], onDelete: Cascade)
|
|
|
|
@@id([taskId, tagId])
|
|
@@map("task_tags")
|
|
}
|
|
|
|
model SyncLog {
|
|
id String @id @default(cuid())
|
|
source String
|
|
status String
|
|
message String?
|
|
tasksSync Int @default(0)
|
|
createdAt DateTime @default(now())
|
|
|
|
@@map("sync_logs")
|
|
}
|
|
|
|
model DailyCheckbox {
|
|
id String @id @default(cuid())
|
|
date DateTime
|
|
text String
|
|
isChecked Boolean @default(false)
|
|
type String @default("task")
|
|
order Int @default(0)
|
|
taskId String?
|
|
userId String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
task Task? @relation(fields: [taskId], references: [id])
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([date])
|
|
@@index([userId])
|
|
@@map("daily_checkboxes")
|
|
}
|
|
|
|
model UserPreferences {
|
|
id String @id @default(cuid())
|
|
userId String @unique
|
|
kanbanFilters Json?
|
|
viewPreferences Json?
|
|
columnVisibility Json?
|
|
jiraConfig Json?
|
|
jiraAutoSync Boolean @default(false)
|
|
jiraSyncInterval String @default("daily")
|
|
tfsConfig Json?
|
|
tfsAutoSync Boolean @default(false)
|
|
tfsSyncInterval String @default("daily")
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@map("user_preferences")
|
|
}
|
|
|
|
model Note {
|
|
id String @id @default(cuid())
|
|
title String
|
|
content String // Markdown content
|
|
userId String
|
|
taskId String? // Tâche associée à la note
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
task Task? @relation(fields: [taskId], references: [id])
|
|
noteTags NoteTag[]
|
|
}
|
|
|
|
model NoteTag {
|
|
noteId String
|
|
tagId String
|
|
tag Tag @relation(fields: [tagId], references: [id], onDelete: Cascade)
|
|
note Note @relation(fields: [noteId], references: [id], onDelete: Cascade)
|
|
|
|
@@id([noteId, tagId])
|
|
@@map("note_tags")
|
|
}
|