feat: add ApiKey model for new Api auth, owned by a user
parent
3341074bb2
commit
76f951d76f
|
@ -150,6 +150,7 @@ model User {
|
|||
metadata Json?
|
||||
verified Boolean? @default(false)
|
||||
|
||||
ApiKey ApiKey[]
|
||||
@@map(name: "users")
|
||||
}
|
||||
|
||||
|
@ -363,3 +364,12 @@ model Webhook {
|
|||
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
eventType EventType? @relation(fields: [eventTypeId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model ApiKey {
|
||||
id String @id @unique @default(cuid())
|
||||
userId Int?
|
||||
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
createdAt DateTime @default(now())
|
||||
expiresAt DateTime @default(dbgenerated("NOW() + interval '30 day'"))
|
||||
metadata Json?
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue