feat: add audit and app log services

This commit is contained in:
QiuSW
2026-07-09 00:55:46 +08:00
parent 3bd05b316e
commit 769c861eb0
20 changed files with 804 additions and 30 deletions
+1 -5
View File
@@ -198,11 +198,7 @@ func (s *AuthService) recordAudit(actor string, action string, targetType string
if strings.TrimSpace(actor) == "" {
actor = "anonymous"
}
_, err := s.store.DB.Exec(`
INSERT INTO audit_logs (actor, action, target_type, target_id, detail, created_at)
VALUES (?, ?, ?, ?, ?, ?)
`, actor, action, targetType, targetID, detail, time.Now().UTC().Format(time.RFC3339))
return err
return recordAuditLog(s.store, actor, action, targetType, targetID, detail)
}
func scanAuthSession(row *sql.Row) (models.AuthSession, error) {