mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
@@ -35,6 +35,8 @@ model User {
|
||||
updatedSnapshot Snapshot[] @relation("updatedSnapshot")
|
||||
createdUpdate Update[] @relation("createdUpdate")
|
||||
createdHistory SnapshotHistory[] @relation("createdHistory")
|
||||
// receive notifications
|
||||
notifications Notification[] @relation("user_notifications")
|
||||
|
||||
@@index([email])
|
||||
@@map("users")
|
||||
@@ -624,3 +626,39 @@ model Blob {
|
||||
@@id([workspaceId, key])
|
||||
@@map("blobs")
|
||||
}
|
||||
|
||||
enum NotificationType {
|
||||
Mention
|
||||
Invitation
|
||||
InvitationAccepted
|
||||
InvitationBlocked
|
||||
InvitationRejected
|
||||
}
|
||||
|
||||
enum NotificationLevel {
|
||||
// Makes a sound and appears as a heads-up notification
|
||||
High
|
||||
// Makes a sound
|
||||
Default
|
||||
// Makes no sound
|
||||
Low
|
||||
Min
|
||||
None
|
||||
}
|
||||
|
||||
model Notification {
|
||||
id String @id @default(uuid()) @db.VarChar
|
||||
userId String @map("user_id") @db.VarChar
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3)
|
||||
updatedAt DateTime @default(now()) @updatedAt @map("updated_at") @db.Timestamptz(3)
|
||||
level NotificationLevel
|
||||
read Boolean @default(false)
|
||||
type NotificationType
|
||||
body Json @db.JsonB
|
||||
|
||||
user User @relation(name: "user_notifications", fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
// for user notifications list, including read and unread, ordered by createdAt
|
||||
@@index([userId, createdAt, read])
|
||||
@@map("notifications")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user