feat(Tags): implement user-specific tag management and enhance related services

- Added ownerId field to Tag model to associate tags with users.
- Updated tagsService methods to enforce user ownership in tag operations.
- Enhanced API routes to include user authentication and ownership checks for tag retrieval and management.
- Modified seeding script to assign tags to the first user found in the database.
- Updated various components and services to ensure user-specific tag handling throughout the application.
This commit is contained in:
Julien Froidefond
2025-10-11 15:03:59 +02:00
parent 583efaa8c5
commit 7952459b42
17 changed files with 329 additions and 177 deletions

View File

@@ -24,6 +24,7 @@ model User {
notes Note[]
dailyCheckboxes DailyCheckbox[]
tasks Task[] @relation("TaskOwner")
tags Tag[] @relation("TagOwner")
@@map("users")
}
@@ -63,13 +64,16 @@ model Task {
model Tag {
id String @id @default(cuid())
name String @unique
name String
color String @default("#6b7280")
isPinned Boolean @default(false)
ownerId String // Chaque tag appartient à un utilisateur
owner User @relation("TagOwner", fields: [ownerId], references: [id], onDelete: Cascade)
taskTags TaskTag[]
primaryTasks Task[] @relation("PrimaryTag")
noteTags NoteTag[]
@@unique([name, ownerId]) // Un nom de tag unique par utilisateur
@@map("tags")
}