feat: add hashedKey to apiKey and lastUsedAt datetime to keep track of usage of keys and makiung them securely stored in db
parent
a3471abcf9
commit
e6b2ff46ed
|
@ -366,10 +366,12 @@ model Webhook {
|
|||
}
|
||||
|
||||
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'"))
|
||||
note String?
|
||||
id String @id @unique @default(cuid())
|
||||
userId Int
|
||||
note String?
|
||||
createdAt DateTime @default(now())
|
||||
expiresAt DateTime @default(dbgenerated("NOW() + interval '30 day'"))
|
||||
lastUsedAt DateTime @default(now())
|
||||
hashedKey String @unique()
|
||||
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue