Skip to content

Commit 58cdf89

Browse files
authored
feat(events): add event creation, attendee management, and public event APIs (#139)
* docs: add Discord community invitation link to README and CONTRIBUTING.md * git commit -m "feat(events-api): implement event management REST API with Prisma models" * fix: revert changes to align with repository tech stack * fix: Revert changes * fix: add location field to schema and update API, validation, and tests * fix: remove accidental schema.prisma file * fix: Updated schema with location in event
1 parent acaf43d commit 58cdf89

5 files changed

Lines changed: 1004 additions & 1 deletion

File tree

apps/backend/prisma/schema.prisma

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
generator client {
22
provider = "prisma-client-js"
33
}
4-
54
datasource db {
65
provider = "postgresql"
76
url = env("DATABASE_URL")
7+
88
}
99

1010
model User {
@@ -29,6 +29,9 @@ model User {
2929
ownedViews CardView[] @relation("cardOwner")
3030
viewedCards CardView[] @relation("cardViewer")
3131
followLogs FollowLog[]
32+
organizer Event[]
33+
attendedEvents EventAttendee[]
34+
3235
3336
@@unique([provider, providerId])
3437
@@map("users")
@@ -124,3 +127,31 @@ model FollowLog {
124127
125128
@@map("follow_logs")
126129
}
130+
131+
model Event {
132+
id String @id @default(uuid())
133+
name String
134+
slug String @unique
135+
location String
136+
description String?
137+
organizerId String
138+
startDate DateTime
139+
endDate DateTime
140+
isPublic Boolean @default(true)
141+
createdAt DateTime @default(now()) @map("created_at")
142+
attendees EventAttendee[]
143+
144+
organizer User @relation(fields: [organizerId], references: [id])
145+
}
146+
147+
model EventAttendee {
148+
id String @id @default(uuid())
149+
userId String
150+
eventId String
151+
joinedAt DateTime
152+
153+
event Event @relation(fields: [eventId] , references: [id])
154+
user User @relation(fields: [userId],references: [id])
155+
156+
@@unique([userId, eventId])
157+
}

0 commit comments

Comments
 (0)