-
Notifications
You must be signed in to change notification settings - Fork 120
feat(backend): Add webhook delivery system for card view events #590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -44,6 +44,7 @@ model User { | |||||||||||||||||||||
| ownedTeams Team[] @relation("TeamOwner") | ||||||||||||||||||||||
| teamMemberships TeamMember[] @relation("TeamMember") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| webhookEndpoints WebhookEndpoint[] | ||||||||||||||||||||||
| @@map("users") | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
@@ -183,20 +184,36 @@ model Event { | |||||||||||||||||||||
| isPublic Boolean @default(true) | ||||||||||||||||||||||
| createdAt DateTime @default(now()) @map("created_at") | ||||||||||||||||||||||
| attendees EventAttendee[] | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| organizer User @relation(fields: [organizerId], references: [id]) | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| model EventAttendee { | ||||||||||||||||||||||
| id String @id @default(uuid()) | ||||||||||||||||||||||
| userId String | ||||||||||||||||||||||
| eventId String | ||||||||||||||||||||||
| joinedAt DateTime | ||||||||||||||||||||||
| joinedAt DateTime | ||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
| } | ||||||||||||||||||||||
| model WebhookDelivery { | ||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As written, this endpoint WebhookEndpoint @relation(fields: [endpointId], references: [id], onDelete: Cascade) |
||||||||||||||||||||||
| id String @id @default(uuid()) | ||||||||||||||||||||||
| endpointId String @map("endpoint_id") | ||||||||||||||||||||||
| eventType String @map("event_type") | ||||||||||||||||||||||
| payload Json | ||||||||||||||||||||||
| status String @default("pending") // "pending" | "success" | "failed" | ||||||||||||||||||||||
| responseCode Int? @map("response_code") | ||||||||||||||||||||||
| attempts Int @default(0) | ||||||||||||||||||||||
| nextRetryAt DateTime? @map("next_retry_at") | ||||||||||||||||||||||
| createdAt DateTime @default(now()) @map("created_at") | ||||||||||||||||||||||
| updatedAt DateTime @updatedAt @map("updated_at") | ||||||||||||||||||||||
| errorMessage String? @map("error_message") | ||||||||||||||||||||||
| deliveredAt DateTime? @map("delivered_at") | ||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| event Event @relation(fields: [eventId] , references: [id]) | ||||||||||||||||||||||
| user User @relation(fields: [userId],references: [id]) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| @@unique([userId, eventId]) | ||||||||||||||||||||||
| @@index([endpointId]) | ||||||||||||||||||||||
| @@index([status, nextRetryAt]) | ||||||||||||||||||||||
| @@map("webhook_deliveries") | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| enum TeamRole { | ||||||||||||||||||||||
|
|
@@ -235,4 +252,5 @@ model TeamMember{ | |||||||||||||||||||||
| @@unique([userId, teamId]) | ||||||||||||||||||||||
| @@index([userId]) | ||||||||||||||||||||||
| @@map("team_members") | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
User.webhookEndpointsreferences aWebhookEndpointmodel that is never defined anywhere in the schema (the routes callprisma.webhookEndpoint.*).prisma generatewill fail. The model needs to be added, e.g.: