tirbofish/kitgit · commit
b1ad0c6422f8f180452f81645bd6f165f457d9b3
merge: feat/user-audit-log into integrate/all-features
Type: SSH
SSH Key Fingerprint:
Verified
SgQHY4vUORbJC3ZtdixCl62ek/4QGh/iG2FRSyjfGPc
@@ -0,0 +1,18 @@ +-- Per-user security / account audit trail (separate from activity_events social feed). +CREATE TABLE IF NOT EXISTS audit_log ( + id BIGSERIAL PRIMARY KEY, + user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE, + actor_id UUID REFERENCES users(id) ON DELETE SET NULL, + action TEXT NOT NULL, + ip TEXT, + user_agent TEXT, + metadata JSONB NOT NULL DEFAULT '{}'::jsonb, + created_at TIMESTAMPTZ NOT NULL DEFAULT now() +); + +CREATE INDEX IF NOT EXISTS audit_log_user_id_created_at_idx + ON audit_log(user_id, created_at DESC); +CREATE INDEX IF NOT EXISTS audit_log_created_at_idx + ON audit_log(created_at DESC); +CREATE INDEX IF NOT EXISTS audit_log_action_idx + ON audit_log(action); @@ -171,6 +171,19 @@ pub struct ActivityEvent { pub created_at: DateTime<Utc>, } +/// Per-user security / account audit entry (not the social activity feed). +#[derive(Debug, Clone, FromRow)] +pub struct AuditLog { + pub id: i64, + pub user_id: Uuid, + pub actor_id: Option<Uuid>, + pub action: String, + pub ip: Option<String>, + pub user_agent: Option<String>, + pub metadata: serde_json::Value, + pub created_at: DateTime<Utc>, +} + #[derive(Debug, Clone, FromRow)] pub struct Issue { pub id: Uuid,
Large diffs are not rendered by default. Showing the first 50 of 740 lines. Show full diff