diff --git a/api/libs/handlers/src/chats/context_loaders/metric_context.rs b/api/libs/handlers/src/chats/context_loaders/metric_context.rs index 2740c4ac0..d4a49063d 100644 --- a/api/libs/handlers/src/chats/context_loaders/metric_context.rs +++ b/api/libs/handlers/src/chats/context_loaders/metric_context.rs @@ -2,7 +2,7 @@ use agents::{Agent, AgentMessage}; use anyhow::{anyhow, Result}; use async_trait::async_trait; use database::{ - models::{Dataset, User}, + models::Dataset, pool::get_pg_pool, schema::{datasets, metric_files}, }; diff --git a/api/libs/handlers/src/chats/delete_chats_handler.rs b/api/libs/handlers/src/chats/delete_chats_handler.rs index 49822c3b1..8964ac637 100644 --- a/api/libs/handlers/src/chats/delete_chats_handler.rs +++ b/api/libs/handlers/src/chats/delete_chats_handler.rs @@ -1,6 +1,6 @@ use anyhow::Result; use chrono::Utc; -use database::models::{Chat, User}; +use database::models::Chat; use database::pool::get_pg_pool; use diesel::prelude::*; use diesel_async::RunQueryDsl; diff --git a/api/libs/handlers/src/chats/list_chats_handler.rs b/api/libs/handlers/src/chats/list_chats_handler.rs index a734f9266..8a37daa87 100644 --- a/api/libs/handlers/src/chats/list_chats_handler.rs +++ b/api/libs/handlers/src/chats/list_chats_handler.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Result}; +use anyhow::Result; use chrono::{DateTime, Utc}; use database::pool::get_pg_pool; use diesel::prelude::*; diff --git a/api/libs/handlers/src/chats/post_chat_handler.rs b/api/libs/handlers/src/chats/post_chat_handler.rs index dd2e4bdff..66b85d77b 100644 --- a/api/libs/handlers/src/chats/post_chat_handler.rs +++ b/api/libs/handlers/src/chats/post_chat_handler.rs @@ -13,10 +13,10 @@ use agents::{ use anyhow::{anyhow, Result}; use chrono::Utc; use database::{ - enums::{AssetPermissionRole, AssetType, IdentityType, Verification}, - models::{AssetPermission, Chat, DashboardFile, Message, MessageToFile, MetricFile, User}, + enums::{AssetPermissionRole, AssetType, IdentityType}, + models::{AssetPermission, Chat, Message, MessageToFile}, pool::get_pg_pool, - schema::{asset_permissions, chats, dashboard_files, messages, messages_to_files, metric_files}, + schema::{asset_permissions, chats, messages, messages_to_files}, }; use diesel::insert_into; use diesel_async::RunQueryDsl; @@ -25,7 +25,7 @@ use litellm::{ Metadata, ToolCall, }; use serde::{Deserialize, Serialize}; -use serde_json::{json, Value}; +use serde_json::Value; use uuid::Uuid; use crate::chats::{ @@ -198,7 +198,7 @@ pub async fn post_chat_handler( // Initialize raw_llm_messages with initial_messages let mut raw_llm_messages = initial_messages.clone(); - let mut raw_response_message = String::new(); + let raw_response_message = String::new(); // Initialize the agent thread let mut chat = AgentThread::new(Some(chat_id), user.id, initial_messages); diff --git a/api/libs/handlers/src/chats/sharing/list_sharing_handler.rs b/api/libs/handlers/src/chats/sharing/list_sharing_handler.rs index 8c13b5748..ec1a9ada2 100644 --- a/api/libs/handlers/src/chats/sharing/list_sharing_handler.rs +++ b/api/libs/handlers/src/chats/sharing/list_sharing_handler.rs @@ -1,6 +1,6 @@ use anyhow::{anyhow, Result}; use database::{ - enums::{AssetPermissionRole, AssetType, IdentityType}, + enums::{AssetType, IdentityType}, pool::get_pg_pool, schema::chats, }; diff --git a/api/libs/handlers/src/chats/sharing/update_sharing_handler.rs b/api/libs/handlers/src/chats/sharing/update_sharing_handler.rs index 2f292afad..d978d389e 100644 --- a/api/libs/handlers/src/chats/sharing/update_sharing_handler.rs +++ b/api/libs/handlers/src/chats/sharing/update_sharing_handler.rs @@ -1,12 +1,6 @@ use anyhow::{anyhow, Result}; use chrono::{DateTime, Utc}; -use database::{ - enums::{AssetPermissionRole, AssetType, IdentityType}, - pool::get_pg_pool, - schema::chats::dsl, -}; -use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl}; -use diesel_async::RunQueryDsl as AsyncRunQueryDsl; +use database::enums::{AssetPermissionRole, AssetType, IdentityType}; use serde::{Deserialize, Serialize}; use sharing::{create_share_by_email, has_permission}; use tracing::info; diff --git a/api/libs/handlers/src/chats/streaming_parser.rs b/api/libs/handlers/src/chats/streaming_parser.rs index 592a0003f..8164f2370 100644 --- a/api/libs/handlers/src/chats/streaming_parser.rs +++ b/api/libs/handlers/src/chats/streaming_parser.rs @@ -1,12 +1,10 @@ use agents::tools::categories::file_tools::common::generate_deterministic_uuid; use anyhow::Result; use serde_json::Value; -use sha2::{Digest, Sha256}; -use uuid::Uuid; +use sha2::Digest; use super::post_chat_handler::{ - BusterFile, BusterFileContent, BusterReasoningFile, BusterReasoningMessage, - BusterReasoningPill, BusterReasoningText, BusterThoughtPill, BusterThoughtPillContainer, + BusterFile, BusterFileContent, BusterReasoningFile, BusterReasoningMessage, BusterReasoningText, }; pub struct StreamingParser { diff --git a/api/libs/handlers/src/chats/update_chats_handler.rs b/api/libs/handlers/src/chats/update_chats_handler.rs index 04d3d7844..b88e97d23 100644 --- a/api/libs/handlers/src/chats/update_chats_handler.rs +++ b/api/libs/handlers/src/chats/update_chats_handler.rs @@ -1,11 +1,9 @@ -use anyhow::{anyhow, Result}; +use anyhow::Result; use chrono::Utc; -use database::models::{Chat, User}; +use database::models::Chat; use database::pool::get_pg_pool; use diesel::prelude::*; -use diesel::pg::expression::dsl::any; use diesel_async::RunQueryDsl; -use futures::future::try_join_all; use serde::{Deserialize, Serialize}; use std::collections::HashSet; use uuid::Uuid; diff --git a/api/libs/handlers/src/collections/delete_collection_handler.rs b/api/libs/handlers/src/collections/delete_collection_handler.rs index 168b6fb05..1a0c4b497 100644 --- a/api/libs/handlers/src/collections/delete_collection_handler.rs +++ b/api/libs/handlers/src/collections/delete_collection_handler.rs @@ -1,7 +1,6 @@ use anyhow::{anyhow, Result}; use chrono::Utc; use database::{ - enums::AssetPermissionRole, pool::get_pg_pool, schema::collections, }; diff --git a/api/libs/handlers/src/collections/get_collection_handler.rs b/api/libs/handlers/src/collections/get_collection_handler.rs index 7c26dba51..1494139fe 100644 --- a/api/libs/handlers/src/collections/get_collection_handler.rs +++ b/api/libs/handlers/src/collections/get_collection_handler.rs @@ -5,7 +5,7 @@ use database::{ enums::{AssetPermissionRole, AssetType, IdentityType}, pool::get_pg_pool, schema::{ - asset_permissions, collections, collections_to_assets, dashboard_files, metric_files, users, + asset_permissions, collections_to_assets, dashboard_files, metric_files, users, }, }; use diesel::{ExpressionMethods, JoinOnDsl, NullableExpressionMethods, QueryDsl, Queryable}; diff --git a/api/libs/handlers/src/dashboards/create_dashboard_handler.rs b/api/libs/handlers/src/dashboards/create_dashboard_handler.rs index c5c13ab2a..560ebef26 100644 --- a/api/libs/handlers/src/dashboards/create_dashboard_handler.rs +++ b/api/libs/handlers/src/dashboards/create_dashboard_handler.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Result}; +use anyhow::Result; use chrono::Utc; use database::pool::get_pg_pool; use database::schema::dashboard_files; diff --git a/api/libs/handlers/src/dashboards/delete_dashboard_handler.rs b/api/libs/handlers/src/dashboards/delete_dashboard_handler.rs index 16f62c62c..21d35945b 100644 --- a/api/libs/handlers/src/dashboards/delete_dashboard_handler.rs +++ b/api/libs/handlers/src/dashboards/delete_dashboard_handler.rs @@ -6,7 +6,6 @@ use diesel::{ExpressionMethods, QueryDsl}; use diesel_async::RunQueryDsl; use serde::{Deserialize, Serialize}; use uuid::Uuid; -use futures::future::try_join_all; #[derive(Debug, Serialize, Deserialize)] pub struct DeleteDashboardsRequest { diff --git a/api/libs/handlers/src/dashboards/get_dashboard_handler.rs b/api/libs/handlers/src/dashboards/get_dashboard_handler.rs index d61750f07..59ec2c0c0 100644 --- a/api/libs/handlers/src/dashboards/get_dashboard_handler.rs +++ b/api/libs/handlers/src/dashboards/get_dashboard_handler.rs @@ -1,11 +1,11 @@ use std::collections::HashMap; use anyhow::{anyhow, Result}; -use diesel::{ExpressionMethods, JoinOnDsl, QueryDsl, Queryable, Selectable, SelectableHelper}; +use diesel::{ExpressionMethods, JoinOnDsl, QueryDsl, Queryable, Selectable}; use diesel_async::RunQueryDsl; -use serde_json::{json, Value}; +use serde_json::Value; use uuid::Uuid; -use futures::future::{try_join_all, join_all}; +use futures::future::join_all; use chrono::{DateTime, Utc}; use serde_yaml; @@ -16,7 +16,7 @@ use database::pool::get_pg_pool; use database::schema::{asset_permissions, dashboard_files, users}; use database::types::VersionHistory; -use super::{BusterDashboard, BusterDashboardResponse, DashboardCollection, DashboardConfig, DashboardRow, DashboardRowItem}; +use super::{BusterDashboard, BusterDashboardResponse, DashboardConfig, DashboardRow, DashboardRowItem}; #[derive(Queryable, Selectable)] #[diesel(table_name = dashboard_files)] diff --git a/api/libs/handlers/src/dashboards/list_dashboard_handler.rs b/api/libs/handlers/src/dashboards/list_dashboard_handler.rs index c4d48c9ed..9470e36e0 100644 --- a/api/libs/handlers/src/dashboards/list_dashboard_handler.rs +++ b/api/libs/handlers/src/dashboards/list_dashboard_handler.rs @@ -1,8 +1,7 @@ -use std::collections::HashMap; use anyhow::{anyhow, Result}; use diesel::{ - BoolExpressionMethods, ExpressionMethods, JoinOnDsl, NullableExpressionMethods, QueryDsl, + ExpressionMethods, QueryDsl, Queryable, Selectable, }; use diesel_async::RunQueryDsl; @@ -11,9 +10,9 @@ use uuid::Uuid; use chrono::{DateTime, Utc}; use database::{ - enums::{AssetPermissionRole, AssetType, IdentityType, Verification}, + enums::Verification, pool::get_pg_pool, - schema::{asset_permissions, dashboard_files, users}, + schema::dashboard_files, }; use super::{BusterDashboardListItem, DashboardMember}; @@ -53,7 +52,7 @@ pub async fn list_dashboard_handler( let offset = request.page_token * request.page_size; // Build the base query - let mut dashboard_statement = dashboard_files::table + let dashboard_statement = dashboard_files::table .select(( dashboard_files::id, dashboard_files::name, diff --git a/api/libs/handlers/src/dashboards/sharing/list_sharing_handler.rs b/api/libs/handlers/src/dashboards/sharing/list_sharing_handler.rs index ad3446dc0..913eeee3e 100644 --- a/api/libs/handlers/src/dashboards/sharing/list_sharing_handler.rs +++ b/api/libs/handlers/src/dashboards/sharing/list_sharing_handler.rs @@ -1,6 +1,6 @@ use anyhow::{anyhow, Result}; use database::{ - enums::{AssetPermissionRole, AssetType, IdentityType}, + enums::{AssetType, IdentityType}, pool::get_pg_pool, schema::dashboard_files, }; diff --git a/api/libs/handlers/src/dashboards/update_dashboard_handler.rs b/api/libs/handlers/src/dashboards/update_dashboard_handler.rs index d43722e8c..2e5c6da42 100644 --- a/api/libs/handlers/src/dashboards/update_dashboard_handler.rs +++ b/api/libs/handlers/src/dashboards/update_dashboard_handler.rs @@ -6,7 +6,7 @@ use database::types::dashboard_yml::{DashboardYml, RowItem, Row}; use database::types::VersionHistory; use database::enums::{AssetPermissionRole, AssetType, IdentityType, Verification}; use database::models::MetricFileToDashboardFile; -use diesel::{ExpressionMethods, QueryDsl, BoolExpressionMethods}; +use diesel::{ExpressionMethods, QueryDsl}; use diesel_async::RunQueryDsl; use serde::{Deserialize, Serialize}; use uuid::Uuid; diff --git a/api/libs/handlers/src/messages/helpers/delete_message_handler.rs b/api/libs/handlers/src/messages/helpers/delete_message_handler.rs index c9af4a978..fc5537f6f 100644 --- a/api/libs/handlers/src/messages/helpers/delete_message_handler.rs +++ b/api/libs/handlers/src/messages/helpers/delete_message_handler.rs @@ -1,6 +1,6 @@ use anyhow::{anyhow, Result}; use chrono::Utc; -use database::{models::{Message, User}, pool::get_pg_pool, schema::messages}; +use database::{models::Message, pool::get_pg_pool, schema::messages}; use diesel::prelude::*; use diesel_async::RunQueryDsl; use tracing::info; diff --git a/api/libs/handlers/src/messages/helpers/update_message_handler.rs b/api/libs/handlers/src/messages/helpers/update_message_handler.rs index 5303806b9..d87f3e873 100644 --- a/api/libs/handlers/src/messages/helpers/update_message_handler.rs +++ b/api/libs/handlers/src/messages/helpers/update_message_handler.rs @@ -4,7 +4,6 @@ use database::{pool::get_pg_pool, schema::messages}; use diesel::prelude::*; use diesel_async::RunQueryDsl; use middleware::AuthenticatedUser; -use serde_json::{json, Value}; use std::str::FromStr; use uuid::Uuid; diff --git a/api/libs/handlers/src/metrics/get_metric_data_handler.rs b/api/libs/handlers/src/metrics/get_metric_data_handler.rs index 361bc2f48..820eef3aa 100644 --- a/api/libs/handlers/src/metrics/get_metric_data_handler.rs +++ b/api/libs/handlers/src/metrics/get_metric_data_handler.rs @@ -3,7 +3,6 @@ use database::types::MetricYml; use indexmap::IndexMap; use middleware::AuthenticatedUser; use serde::{Deserialize, Serialize}; -use serde_json::Value; use std::collections::HashSet; use uuid::Uuid; diff --git a/api/libs/handlers/src/metrics/get_metric_handler.rs b/api/libs/handlers/src/metrics/get_metric_handler.rs index 94b2fbc27..0ce9177fe 100644 --- a/api/libs/handlers/src/metrics/get_metric_handler.rs +++ b/api/libs/handlers/src/metrics/get_metric_handler.rs @@ -1,6 +1,6 @@ use anyhow::{anyhow, Result}; use database::types::VersionHistory; -use diesel::{ExpressionMethods, JoinOnDsl, QueryDsl, Queryable, Selectable, SelectableHelper}; +use diesel::{ExpressionMethods, JoinOnDsl, QueryDsl, Queryable, Selectable}; use diesel_async::RunQueryDsl; use serde_json::Value; use serde_yaml; diff --git a/api/libs/handlers/src/metrics/types.rs b/api/libs/handlers/src/metrics/types.rs index 9f96d0c2b..47caaf302 100644 --- a/api/libs/handlers/src/metrics/types.rs +++ b/api/libs/handlers/src/metrics/types.rs @@ -1,7 +1,6 @@ use chrono::{DateTime, Utc}; -use database::{enums::{AssetPermissionRole, Verification}, types::{ChartConfig, VersionHistory}}; +use database::{enums::{AssetPermissionRole, Verification}, types::ChartConfig}; use serde::{Deserialize, Serialize}; -use serde_json::Value; use uuid::Uuid; use std::collections::HashMap; diff --git a/api/libs/handlers/src/utils/user/user_info.rs b/api/libs/handlers/src/utils/user/user_info.rs index 1c64d6335..b59be0e4a 100644 --- a/api/libs/handlers/src/utils/user/user_info.rs +++ b/api/libs/handlers/src/utils/user/user_info.rs @@ -1,11 +1,11 @@ use anyhow::{anyhow, Result}; -use diesel::{BoolExpressionMethods, ExpressionMethods, JoinOnDsl, QueryDsl}; +use diesel::{ExpressionMethods, QueryDsl}; use diesel_async::RunQueryDsl; use uuid::Uuid; use database::{ pool::get_pg_pool, - schema::{organizations, users_to_organizations}, + schema::users_to_organizations, }; pub async fn get_user_organization_id(user_id: &Uuid) -> Result {