swarm / companies/starter/work/project/src/sync/metrics.rs

raw file 602 bytes
use uuid::Uuid;
use chrono::{DateTime, Utc};

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CustomerMetrics {
    pub customer_id: Uuid,
    pub table_name: String,
    pub row_count: i64,
    pub last_sync_at: DateTime<Utc>,
    pub drift_detected: bool,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DashboardResponse {
    pub metrics: Vec<CustomerMetrics>,
    pub generated_at: DateTime<Utc>,
}

impl DashboardResponse {
    pub fn new(metrics: Vec<CustomerMetrics>) -> Self {
        Self {
            metrics,
            generated_at: Utc::now(),
        }
    }
}