mirror of
https://github.com/LukeHagar/relay.git
synced 2025-12-09 12:47:49 +00:00
Implement SvelteKit webhook relay with SSE, auth, and real-time features
Co-authored-by: lukeslakemail <lukeslakemail@gmail.com>
This commit is contained in:
114
sveltekit-integration/prisma/schema.prisma
Normal file
114
sveltekit-integration/prisma/schema.prisma
Normal file
@@ -0,0 +1,114 @@
|
||||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(cuid())
|
||||
email String @unique
|
||||
subdomain String @unique
|
||||
name String?
|
||||
username String @unique
|
||||
image String?
|
||||
emailVerified DateTime?
|
||||
accounts Account[]
|
||||
sessions Session[]
|
||||
relayTargets RelayTarget[]
|
||||
webhookEvents WebhookEvent[]
|
||||
|
||||
// Optional for WebAuthn support
|
||||
Authenticator Authenticator[]
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model Account {
|
||||
userId String
|
||||
type String
|
||||
provider String
|
||||
providerAccountId String
|
||||
refresh_token String?
|
||||
access_token String?
|
||||
expires_at Int?
|
||||
token_type String?
|
||||
scope String?
|
||||
id_token String?
|
||||
session_state String?
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@id([provider, providerAccountId])
|
||||
}
|
||||
|
||||
model Session {
|
||||
sessionToken String @unique
|
||||
userId String
|
||||
expires DateTime
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model VerificationToken {
|
||||
identifier String
|
||||
token String
|
||||
expires DateTime
|
||||
|
||||
@@id([identifier, token])
|
||||
}
|
||||
|
||||
// Optional for WebAuthn support
|
||||
model Authenticator {
|
||||
credentialID String @unique
|
||||
userId String
|
||||
providerAccountId String
|
||||
credentialPublicKey String
|
||||
counter Int
|
||||
credentialDeviceType String
|
||||
credentialBackedUp Boolean
|
||||
transports String?
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@id([userId, credentialID])
|
||||
}
|
||||
|
||||
// Webhook Event schema
|
||||
model WebhookEvent {
|
||||
id String @id @default(cuid())
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
userId String
|
||||
path String
|
||||
query String
|
||||
method String
|
||||
body String
|
||||
headers String
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@index([userId, createdAt])
|
||||
}
|
||||
|
||||
// Webhook Relay Target schema
|
||||
model RelayTarget {
|
||||
id String @id @default(cuid())
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
userId String
|
||||
target String
|
||||
nickname String?
|
||||
createdAt DateTime @default(now())
|
||||
active Boolean @default(true)
|
||||
|
||||
@@index([userId, active])
|
||||
}
|
||||
Reference in New Issue
Block a user