feat: 添加分页功能和缓存管理,优化问答记录展示
This commit is contained in:
+16
-11
@@ -13,17 +13,19 @@ datasource db {
|
||||
// Better Auth 标准用户表
|
||||
// apiToken 由服务端注册 hook 生成,供 OCS 油猴脚本跨域身份验证
|
||||
model User {
|
||||
id String @id
|
||||
name String
|
||||
email String @unique
|
||||
emailVerified Boolean
|
||||
image String?
|
||||
createdAt DateTime
|
||||
updatedAt DateTime
|
||||
apiToken String? @unique
|
||||
sessions Session[]
|
||||
accounts Account[]
|
||||
qaRecords QaRecord[]
|
||||
id String @id
|
||||
name String
|
||||
email String @unique
|
||||
emailVerified Boolean
|
||||
image String?
|
||||
createdAt DateTime
|
||||
updatedAt DateTime
|
||||
apiToken String? @unique
|
||||
/// 用户最近一次清缓存的时间;只有在此时间之后写入的记录才算缓存命中
|
||||
cacheClearedAt DateTime?
|
||||
sessions Session[]
|
||||
accounts Account[]
|
||||
qaRecords QaRecord[]
|
||||
|
||||
@@map("user")
|
||||
}
|
||||
@@ -85,7 +87,10 @@ model QaRecord {
|
||||
type String
|
||||
options String? @db.Text
|
||||
answer String? @db.Text
|
||||
/// 题目+题型+选项的 MD5,用于 DB 缓存查询;老记录为 null
|
||||
hash String? @db.Char(32)
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@index([userId, hash])
|
||||
@@map("qa_record")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user