Implement event registration functionality: Add EventRegistration model to Prisma schema, enabling user event registrations. Enhance EventsPageSection component with registration checks, calendar view, and improved event display. Refactor event rendering logic to separate upcoming and past events, improving user experience.
This commit is contained in:
@@ -44,6 +44,7 @@ model User {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
preferences UserPreferences?
|
||||
eventRegistrations EventRegistration[]
|
||||
|
||||
@@index([score])
|
||||
@@index([email])
|
||||
@@ -75,11 +76,25 @@ model Event {
|
||||
status EventStatus
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
registrations EventRegistration[]
|
||||
|
||||
@@index([status])
|
||||
@@index([date])
|
||||
}
|
||||
|
||||
model EventRegistration {
|
||||
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)
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@unique([userId, eventId])
|
||||
@@index([userId])
|
||||
@@index([eventId])
|
||||
}
|
||||
|
||||
model SitePreferences {
|
||||
id String @id @default("global")
|
||||
homeBackground String?
|
||||
|
||||
Reference in New Issue
Block a user