swarmhive_api_types/
audit.rs1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3use utoipa::ToSchema;
4use uuid::Uuid;
5
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, ToSchema)]
7#[serde(rename_all = "snake_case")]
8pub enum ActorType {
9 User,
10 Token,
11 System,
12}
13
14#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, ToSchema)]
15pub struct AuditLog {
16 pub id: Uuid,
17 pub actor_type: ActorType,
18 pub actor_id: Option<Uuid>,
19 pub org_id: Uuid,
20 pub app_id: Option<Uuid>,
21 pub action: String,
22 pub resource_type: Option<String>,
23 pub resource_id: Option<String>,
24 pub ip: Option<String>,
25 pub user_agent: Option<String>,
26 pub metadata: serde_json::Value,
27 pub created_at: DateTime<Utc>,
28}