feat(Notes): associate notes with tasks and enhance note management
- Added taskId field to Note model for associating notes with tasks. - Updated API routes to handle taskId in note creation and updates. - Enhanced NotesPageClient to manage task associations within notes. - Integrated task selection in MarkdownEditor for better user experience. - Updated NotesService to map task data correctly when retrieving notes.
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Note" ADD COLUMN "taskId" TEXT;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Note" ADD CONSTRAINT "Note_taskId_fkey" FOREIGN KEY ("taskId") REFERENCES "tasks"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
@@ -51,6 +51,7 @@ model Task {
|
||||
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")
|
||||
@@ -129,9 +130,11 @@ model Note {
|
||||
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[]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user