feat(server): 站内通知基础设施与关键事件触发(F14,F30)
- 新增 notifications 表与 API(list/mark-read) - submit/approve/reject/return/transfer/pay/forgot-password 写入站内通知 - 通知失败降级,不阻塞主流程
这个提交包含在:
@@ -172,6 +172,7 @@ model Employee {
|
||||
|
||||
auth_sessions AuthSession[]
|
||||
audit_logs AuditLog[] @relation("AuditActor")
|
||||
notifications Notification[]
|
||||
|
||||
submitted_reimbursements ReimbursementForm[] @relation("ReimbursementSubmitter")
|
||||
owned_reimbursements ReimbursementForm[] @relation("ReimbursementOwner")
|
||||
@@ -286,6 +287,24 @@ model AuditLog {
|
||||
@@map("audit_logs")
|
||||
}
|
||||
|
||||
model Notification {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
recipient_employee_id String @db.Uuid
|
||||
type String @db.VarChar(64)
|
||||
title String @db.VarChar(200)
|
||||
body String?
|
||||
target_type String? @db.VarChar(64)
|
||||
target_id String? @db.Uuid
|
||||
read_at DateTime?
|
||||
created_at DateTime @default(now())
|
||||
|
||||
recipient Employee @relation(fields: [recipient_employee_id], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([recipient_employee_id, created_at])
|
||||
@@index([recipient_employee_id, read_at, created_at], map: "idx_notifications_unread_query")
|
||||
@@map("notifications")
|
||||
}
|
||||
|
||||
model ExpenseType {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
code String @unique
|
||||
|
||||
在新工单中引用
屏蔽一个用户