feat: 完善后台导入日志权限与备份恢复
This commit is contained in:
@@ -91,8 +91,11 @@ enum QueryResult {
|
||||
enum JobType {
|
||||
GEN_CODE
|
||||
IMPORT_OUTBOUND
|
||||
IMPORT_OUTBOUND_PREVIEW
|
||||
WATERMARK
|
||||
ONCHAIN
|
||||
BACKUP
|
||||
RESTORE
|
||||
}
|
||||
|
||||
enum JobStatus {
|
||||
@@ -103,6 +106,29 @@ enum JobStatus {
|
||||
FAILED
|
||||
}
|
||||
|
||||
enum OutboundImportSessionStatus {
|
||||
PARSING
|
||||
READY
|
||||
IMPORTING
|
||||
IMPORTED
|
||||
FAILED
|
||||
EXPIRED
|
||||
}
|
||||
|
||||
enum OutboundImportRowStatus {
|
||||
VALID
|
||||
INVALID
|
||||
IMPORTED
|
||||
FAILED
|
||||
}
|
||||
|
||||
enum BackupStatus {
|
||||
PENDING
|
||||
PROCESSING
|
||||
SUCCESS
|
||||
FAILED
|
||||
}
|
||||
|
||||
model SysUser {
|
||||
id Int @id @default(autoincrement())
|
||||
username String @unique
|
||||
@@ -115,6 +141,9 @@ model SysUser {
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
artworks Artwork[]
|
||||
operationLogs OperationLog[]
|
||||
outboundImportSessions OutboundImportSession[]
|
||||
backupRecords BackupRecord[]
|
||||
|
||||
@@map("sys_user")
|
||||
}
|
||||
@@ -251,6 +280,7 @@ model TraceCode {
|
||||
groupId Int? @map("group_id")
|
||||
outTime DateTime? @map("out_time")
|
||||
outImage String? @map("out_image")
|
||||
outImages Json? @map("out_images")
|
||||
remark String?
|
||||
status TraceCodeStatus @default(INACTIVE)
|
||||
queryCount Int @default(0) @map("query_count")
|
||||
@@ -336,6 +366,106 @@ model Job {
|
||||
@@map("job")
|
||||
}
|
||||
|
||||
model OperationLog {
|
||||
id BigInt @id @default(autoincrement())
|
||||
userId Int? @map("user_id")
|
||||
username String?
|
||||
role RoleType?
|
||||
module String
|
||||
action String
|
||||
method String
|
||||
path String
|
||||
targetId String? @map("target_id")
|
||||
status String
|
||||
message String? @db.Text
|
||||
ip String?
|
||||
userAgent String? @db.Text @map("user_agent")
|
||||
durationMs Int? @map("duration_ms")
|
||||
requestSummary Json? @map("request_summary")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
user SysUser? @relation(fields: [userId], references: [id])
|
||||
|
||||
@@index([userId])
|
||||
@@index([module])
|
||||
@@index([action])
|
||||
@@index([status])
|
||||
@@index([createdAt])
|
||||
@@map("operation_log")
|
||||
}
|
||||
|
||||
model OutboundImportSession {
|
||||
id String @id @default(cuid())
|
||||
status OutboundImportSessionStatus @default(PARSING)
|
||||
fileName String @map("file_name")
|
||||
fileKey String? @map("file_key")
|
||||
total Int @default(0)
|
||||
validCount Int @default(0) @map("valid_count")
|
||||
invalidCount Int @default(0) @map("invalid_count")
|
||||
error String? @db.Text
|
||||
committedAt DateTime? @map("committed_at")
|
||||
expiresAt DateTime @map("expires_at")
|
||||
createdBy Int? @map("created_by")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
creator SysUser? @relation(fields: [createdBy], references: [id])
|
||||
rows OutboundImportRow[]
|
||||
|
||||
@@index([status])
|
||||
@@index([createdBy])
|
||||
@@index([expiresAt])
|
||||
@@map("outbound_import_session")
|
||||
}
|
||||
|
||||
model OutboundImportRow {
|
||||
id BigInt @id @default(autoincrement())
|
||||
sessionId String @map("session_id")
|
||||
rowNo Int @map("row_no")
|
||||
status OutboundImportRowStatus @default(INVALID)
|
||||
shortCode String? @map("short_code")
|
||||
batchNo String? @map("batch_no")
|
||||
outTime DateTime? @map("out_time")
|
||||
outImagePaths Json? @map("out_image_paths")
|
||||
outImageKeys Json? @map("out_image_keys")
|
||||
txHash String? @map("tx_hash")
|
||||
onchainAt DateTime? @map("onchain_at")
|
||||
blockHeight BigInt? @map("block_height")
|
||||
remark String?
|
||||
reason String? @db.Text
|
||||
preview Json?
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
session OutboundImportSession @relation(fields: [sessionId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([sessionId])
|
||||
@@index([status])
|
||||
@@index([shortCode])
|
||||
@@map("outbound_import_row")
|
||||
}
|
||||
|
||||
model BackupRecord {
|
||||
id String @id @default(cuid())
|
||||
fileName String @map("file_name")
|
||||
filePath String @map("file_path")
|
||||
size BigInt @default(0)
|
||||
status BackupStatus @default(PENDING)
|
||||
mode String @default("BACKUP")
|
||||
manifest Json?
|
||||
error String? @db.Text
|
||||
createdBy Int? @map("created_by")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
creator SysUser? @relation(fields: [createdBy], references: [id])
|
||||
|
||||
@@index([status])
|
||||
@@index([mode])
|
||||
@@index([createdBy])
|
||||
@@index([createdAt])
|
||||
@@map("backup_record")
|
||||
}
|
||||
|
||||
model SystemSetting {
|
||||
id Int @id @default(autoincrement())
|
||||
key String @unique
|
||||
|
||||
Reference in New Issue
Block a user