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
+12
View File
@@ -126,6 +126,18 @@ func Migrate(db *sql.DB) error {
CREATE INDEX IF NOT EXISTS idx_image_tasks_status_created_at ON image_tasks(status, created_at);
CREATE INDEX IF NOT EXISTS idx_image_task_results_task_id ON image_task_results(task_id);
CREATE TABLE IF NOT EXISTS app_logs (
id INTEGER PRIMARY KEY AUTOINCREMENT,
level TEXT NOT NULL,
module TEXT NOT NULL,
message TEXT NOT NULL,
detail TEXT NOT NULL,
created_at TEXT NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_app_logs_level_created_at ON app_logs(level, created_at);
CREATE INDEX IF NOT EXISTS idx_audit_logs_action_created_at ON audit_logs(action, created_at);
`)
if err != nil {
return err