feat: add risk review phase
This commit is contained in:
@@ -26,6 +26,9 @@ model Tenant {
|
||||
smsSignatures SmsSignature[]
|
||||
smsTemplates SmsTemplate[]
|
||||
auditRecords AuditRecord[]
|
||||
riskRules RiskRule[]
|
||||
smsSendTasks SmsSendTask[]
|
||||
riskHitRecords RiskHitRecord[]
|
||||
}
|
||||
|
||||
model User {
|
||||
@@ -42,6 +45,8 @@ model User {
|
||||
roles UserRole[]
|
||||
operationLogs OperationLog[]
|
||||
auditRecords AuditRecord[]
|
||||
createdSmsSendTasks SmsSendTask[] @relation("SmsSendTaskCreator")
|
||||
reviewedSmsSendTasks SmsSendTask[] @relation("SmsSendTaskReviewer")
|
||||
}
|
||||
|
||||
model Role {
|
||||
@@ -293,6 +298,7 @@ model SmsApplication {
|
||||
ipAllowlist SmsApplicationIpAllowlist[]
|
||||
signatures SmsSignature[]
|
||||
templates SmsTemplate[]
|
||||
sendTasks SmsSendTask[]
|
||||
|
||||
@@index([tenantId, status])
|
||||
}
|
||||
@@ -363,6 +369,7 @@ model SmsTemplate {
|
||||
application SmsApplication @relation(fields: [applicationId], references: [id])
|
||||
signature SmsSignature? @relation(fields: [signatureId], references: [id])
|
||||
variables TemplateVariable[]
|
||||
sendTasks SmsSendTask[]
|
||||
|
||||
@@index([tenantId, auditStatus])
|
||||
@@index([applicationId])
|
||||
@@ -599,3 +606,82 @@ model ReportReceiptImport {
|
||||
|
||||
task ChannelSignatureReportTask @relation(fields: [taskId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model RiskRule {
|
||||
id String @id @default(cuid())
|
||||
tenantId String?
|
||||
code String
|
||||
name String
|
||||
description String?
|
||||
metric String
|
||||
thresholdValue Float
|
||||
action String @default("manual_review")
|
||||
status String @default("active")
|
||||
priority Int @default(100)
|
||||
config Json?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
tenant Tenant? @relation(fields: [tenantId], references: [id])
|
||||
hits RiskHitRecord[]
|
||||
|
||||
@@unique([tenantId, code])
|
||||
@@index([tenantId, status, priority])
|
||||
}
|
||||
|
||||
model SmsSendTask {
|
||||
id String @id @default(cuid())
|
||||
tenantId String
|
||||
applicationId String?
|
||||
templateId String?
|
||||
taskNo String @unique
|
||||
content String
|
||||
category String?
|
||||
phoneTotal Int
|
||||
uniquePhoneTotal Int
|
||||
duplicateRatio Float @default(0)
|
||||
illegalRatio Float @default(0)
|
||||
blacklistHitRatio Float @default(0)
|
||||
variableIssues Json?
|
||||
status String @default("created")
|
||||
riskDecision String @default("allow")
|
||||
reviewReason String?
|
||||
rejectReason String?
|
||||
createdById String?
|
||||
reviewedById String?
|
||||
reviewedAt DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
tenant Tenant @relation(fields: [tenantId], references: [id])
|
||||
application SmsApplication? @relation(fields: [applicationId], references: [id])
|
||||
template SmsTemplate? @relation(fields: [templateId], references: [id])
|
||||
createdBy User? @relation("SmsSendTaskCreator", fields: [createdById], references: [id])
|
||||
reviewedBy User? @relation("SmsSendTaskReviewer", fields: [reviewedById], references: [id])
|
||||
riskHits RiskHitRecord[]
|
||||
|
||||
@@index([tenantId, status, createdAt])
|
||||
@@index([applicationId, createdAt])
|
||||
}
|
||||
|
||||
model RiskHitRecord {
|
||||
id String @id @default(cuid())
|
||||
tenantId String
|
||||
taskId String
|
||||
ruleId String?
|
||||
ruleCode String
|
||||
ruleName String
|
||||
thresholdValue Float
|
||||
actualValue Float
|
||||
action String
|
||||
reason String
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
tenant Tenant @relation(fields: [tenantId], references: [id])
|
||||
task SmsSendTask @relation(fields: [taskId], references: [id], onDelete: Cascade)
|
||||
rule RiskRule? @relation(fields: [ruleId], references: [id])
|
||||
|
||||
@@index([tenantId, createdAt])
|
||||
@@index([taskId])
|
||||
@@index([ruleCode])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user