Implement event feedback functionality: Add EventFeedback model to Prisma schema, enabling users to submit ratings and comments for events. Update EventsPageSection and AdminPanel components to support feedback management, including UI for submitting feedback and viewing existing feedbacks. Refactor registration logic to retrieve all user registrations for improved feedback handling.
This commit is contained in:
@@ -54,6 +54,7 @@ model User {
|
||||
updatedAt DateTime @updatedAt
|
||||
preferences UserPreferences?
|
||||
eventRegistrations EventRegistration[]
|
||||
eventFeedbacks EventFeedback[]
|
||||
|
||||
@@index([score])
|
||||
@@index([email])
|
||||
@@ -88,6 +89,7 @@ model Event {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
registrations EventRegistration[]
|
||||
feedbacks EventFeedback[]
|
||||
|
||||
@@index([date])
|
||||
}
|
||||
@@ -105,6 +107,22 @@ model EventRegistration {
|
||||
@@index([eventId])
|
||||
}
|
||||
|
||||
model EventFeedback {
|
||||
id String @id @default(cuid())
|
||||
userId String
|
||||
eventId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
event Event @relation(fields: [eventId], references: [id], onDelete: Cascade)
|
||||
rating Int // Note de 1 à 5
|
||||
comment String? // Commentaire optionnel
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@unique([userId, eventId])
|
||||
@@index([userId])
|
||||
@@index([eventId])
|
||||
}
|
||||
|
||||
model SitePreferences {
|
||||
id String @id @default("global")
|
||||
homeBackground String?
|
||||
|
||||
Reference in New Issue
Block a user