use uuid::Uuid; use crate::{ error::Result, model::{AuditAction, AuditEntry, MediaId}, storage::DynStorageBackend, }; /// Records an audit action for a media item. /// /// # Arguments /// /// * `storage` - Storage backend for persistence /// * `media_id` - Optional media item that was affected /// * `action` - The action being performed /// * `details` - Optional additional details /// /// # Returns /// /// `Ok(())` on success /// /// # Errors /// /// Returns errors from the storage backend pub async fn record_action( storage: &DynStorageBackend, media_id: Option, action: AuditAction, details: Option, ) -> Result<()> { let entry = AuditEntry { id: Uuid::now_v7(), media_id, action, details, timestamp: chrono::Utc::now(), }; storage.record_audit(&entry).await }