feat: add file safety config integration

This commit is contained in:
richjohnrambo
2026-08-23 23:50:21 +08:00
parent 7b942da975
commit ed9413d923
20 changed files with 1407 additions and 2 deletions
+18
View File
@@ -155,6 +155,24 @@ func (registrationConfigMapper) SMSEnabled() (bool, error) {
return configAdp.RegistrationSMSEnabled()
}
// ThirdPartyConfigPersistenceInterface exposes global third-party integration settings.
type ThirdPartyConfigPersistenceInterface interface {
Get(group string, keys ...string) (map[string]string, error)
}
type thirdPartyConfigMapper struct{}
// ThirdPartyConfig reads third-party settings from the control database.
var ThirdPartyConfig ThirdPartyConfigPersistenceInterface = thirdPartyConfigMapper{}
func (thirdPartyConfigMapper) Get(group string, keys ...string) (map[string]string, error) {
configAdp, ok := adp.(adapter.ThirdPartyConfigAdapter)
if !ok {
return nil, types.ErrUnsupported
}
return configAdp.ThirdPartyConfig(group, keys...)
}
// GetByCode resolves a tenant by its public enterprise code.
func (tenantsMapper) GetByCode(code string) (*types.Tenant, error) {
tenantAdp, ok := adp.(adapter.TenantAdapter)
+37
View File
@@ -10,6 +10,18 @@ const (
AbuseReportStatusReceived = "received"
FeedbackStatusReceived = "received"
FileReviewTaskTypeContent = "content"
FileReviewTaskTypeMalware = "malware"
FileReviewProviderAliyunGreen = "aliyun_green"
FileReviewProviderAliyunSAS = "aliyun_sas"
FileReviewStatusPending = "pending"
FileReviewStatusRunning = "running"
FileReviewStatusClean = "clean"
FileReviewStatusRisky = "risky"
FileReviewStatusFailed = "failed"
)
type RiskChallenge struct {
@@ -84,3 +96,28 @@ type FeedbackSubmission struct {
CreatedAt time.Time
UpdatedAt time.Time
}
type FileReviewTask struct {
ID int64
TaskID string
FileID Uid
UserID Uid
TaskType string
Provider string
StorageProvider string
ObjectName string
MimeType string
FileSize int64
ProviderTaskID string
Status string
RiskLevel string
RiskLabels []string
ResultJSON map[string]any
ErrorCode string
ErrorMessage string
Attempts int
NextRetryAt *time.Time
CreatedAt time.Time
UpdatedAt time.Time
CompletedAt *time.Time
}