test: add comprehensive test coverage and improve code quality

- Add new test files for auth, service, and handler modules
- Improve test organization and coverage
- Refactor code for better maintainability
- Add captcha, settings, stats, and theme handler tests
- Add auth module tests (CAS, OAuth, password, SSO, state)
- Add service layer tests for auth, export, permissions, roles
- All Go tests pass (exit code 0)
- All frontend tests pass (325 tests in 59 files)
This commit is contained in:
2026-04-17 20:43:50 +08:00
parent 0d66aa0423
commit 582ad7a069
136 changed files with 19010 additions and 8544 deletions

View File

@@ -30,17 +30,17 @@ const (
// Webhook Webhook 配置
type Webhook struct {
ID int64 `gorm:"primaryKey;autoIncrement" json:"id"`
Name string `gorm:"type:varchar(100);not null" json:"name"`
URL string `gorm:"type:varchar(500);not null" json:"url"`
Secret string `gorm:"type:varchar(255)" json:"-"` // HMAC 签名密钥,不返回给前端
Events string `gorm:"type:text" json:"events"` // JSON 数组,订阅的事件类型
Status WebhookStatus `gorm:"default:1" json:"status"`
MaxRetries int `gorm:"default:3" json:"max_retries"`
TimeoutSec int `gorm:"default:10" json:"timeout_sec"`
CreatedBy int64 `gorm:"index" json:"created_by"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
ID int64 `gorm:"primaryKey;autoIncrement" json:"id"`
Name string `gorm:"type:varchar(100);not null" json:"name"`
URL string `gorm:"type:varchar(500);not null" json:"url"`
Secret string `gorm:"type:varchar(255)" json:"-"` // HMAC 签名密钥,不返回给前端
Events string `gorm:"type:text" json:"events"` // JSON 数组,订阅的事件类型
Status WebhookStatus `gorm:"default:1" json:"status"`
MaxRetries int `gorm:"default:3" json:"max_retries"`
TimeoutSec int `gorm:"default:10" json:"timeout_sec"`
CreatedBy int64 `gorm:"index" json:"created_by"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
}
// TableName 指定表名