feat: activity log backend foundation

This commit is contained in:
fsylvain committed 2026-10-06 20:35:03 +02:00
1 parent 8907bb49fe
commit 50b1649965
74 files changed
+5949 -239

No files matched your search

@@ -0,0 +1,24 @@
package models
import "time"
type AuditEvent struct {
ID uint64 `gorm:"primaryKey;autoIncrement"`
CreatedAt time.Time `gorm:"not null;index:idx_audit_events_created_at;index:idx_audit_events_actor,priority:3;index:idx_audit_events_category,priority:2"`
Action string `gorm:"not null;size:64"`
Category string `gorm:"not null;size:16;index:idx_audit_events_category,priority:1"`
ActorType string `gorm:"not null;size:16;index:idx_audit_events_actor,priority:1"`
ActorID *uint32 `gorm:"index:idx_audit_events_actor,priority:2"`
ActorName string `gorm:"not null;size:255"`
TargetType string `gorm:"not null;size:32"`
TargetID string `gorm:"not null;size:64"`
TargetName string `gorm:"not null;size:255"`
Outcome string `gorm:"not null;size:16"`
FailureReason *string `gorm:"size:255"`
Security bool `gorm:"not null"`
Source string `gorm:"not null;size:16"`
IP *string `gorm:"size:64"`
UserAgent *string `gorm:"size:255"`
Params string `gorm:"not null;type:text"`
Changes string `gorm:"not null;type:text"`
}
@@ -0,0 +1,10 @@
package models
import "time"
type AuditSettings struct {
ID uint32 `gorm:"primaryKey"`
RetentionDays int `gorm:"not null"`
LastCleanupAt *time.Time
LastCleanupRemoved int `gorm:"not null"`
}