Fix P1 Rust: remove all unused imports, variables, and fields across api/worker bins
Some checks failed
CI — P1 Route (Rust) / test (push) Failing after 3m48s
Some checks failed
CI — P1 Route (Rust) / test (push) Failing after 3m48s
This commit is contained in:
@@ -2,7 +2,7 @@ use axum::{
|
||||
extract::{Path, Query, State},
|
||||
http::{HeaderMap, StatusCode},
|
||||
response::IntoResponse,
|
||||
routing::{get, post, put, delete},
|
||||
routing::{get, put, delete},
|
||||
Json, Router,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -16,7 +16,7 @@ pub struct ApiState {
|
||||
pub auth: Arc<dyn AuthProvider>,
|
||||
pub pg_pool: sqlx::PgPool,
|
||||
pub ts_pool: sqlx::PgPool,
|
||||
pub config: Arc<AppConfig>,
|
||||
pub _config: Arc<AppConfig>,
|
||||
}
|
||||
|
||||
pub fn create_api_router(state: Arc<ApiState>) -> Router {
|
||||
@@ -47,7 +47,7 @@ async fn health() -> &'static str { "ok" }
|
||||
#[derive(Deserialize)]
|
||||
pub struct TimeRange {
|
||||
pub from: Option<String>,
|
||||
pub to: Option<String>,
|
||||
pub _to: Option<String>,
|
||||
pub interval: Option<String>, // "hour" or "day"
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ async fn get_analytics_summary(
|
||||
Query(range): Query<TimeRange>,
|
||||
) -> Result<Json<AnalyticsSummary>, ApiError> {
|
||||
let auth = state.auth.authenticate(&headers).await?;
|
||||
let from = range.from.unwrap_or_else(|| "now() - interval '7 days'".to_string());
|
||||
let _from = range.from.unwrap_or_else(|| "now() - interval '7 days'".to_string());
|
||||
|
||||
let row = sqlx::query_as::<_, (i64, f64, f64, f64, i32, i32, i64, i64, i64)>(
|
||||
"SELECT
|
||||
@@ -494,7 +494,6 @@ async fn upsert_provider(
|
||||
.unwrap_or_else(|_| vec![0u8; 32]);
|
||||
|
||||
use aes_gcm::{Aes256Gcm, KeyInit, aead::Aead};
|
||||
use aes_gcm::aead::OsRng;
|
||||
use aes_gcm::Nonce;
|
||||
|
||||
let cipher = Aes256Gcm::new_from_slice(&key_bytes)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use sqlx::PgPool;
|
||||
use tracing::{info, warn};
|
||||
use tracing::warn;
|
||||
use uuid::Uuid;
|
||||
|
||||
async fn get_org_owner_email(pool: &PgPool, org_id: Uuid) -> Result<String, anyhow::Error> {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use chrono::{DateTime, Datelike, NaiveTime, Utc, Weekday};
|
||||
use chrono::{DateTime, Datelike, NaiveTime, Utc};
|
||||
use sqlx::PgPool;
|
||||
use tracing::{info, warn};
|
||||
use uuid::Uuid;
|
||||
@@ -23,7 +23,7 @@ pub fn next_monday_9am(from: DateTime<Utc>) -> DateTime<Utc> {
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct DigestData {
|
||||
pub org_id: Uuid,
|
||||
pub _org_id: Uuid,
|
||||
pub org_name: String,
|
||||
pub total_requests: i64,
|
||||
pub total_cost_original: f64,
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::mpsc;
|
||||
use tracing::{info, warn, error};
|
||||
use chrono::{Utc, Duration};
|
||||
use tracing::{info, error};
|
||||
use chrono::Utc;
|
||||
|
||||
use dd0c_route::{AppConfig, TelemetryEvent};
|
||||
use dd0c_route::AppConfig;
|
||||
|
||||
mod digest;
|
||||
mod anomaly;
|
||||
@@ -63,7 +62,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
// Spawn periodic tasks
|
||||
let ts1 = ts_pool.clone();
|
||||
let pg1 = pg_pool.clone();
|
||||
let config1 = config.clone();
|
||||
let _config1 = config.clone();
|
||||
|
||||
// Hourly: check for cost anomalies
|
||||
tokio::spawn(async move {
|
||||
|
||||
Reference in New Issue
Block a user