|
|
|
|
@ -7,6 +7,7 @@ use uuid::Uuid;
|
|
|
|
|
/// User settings record from the database.
|
|
|
|
|
#[derive(Debug, Clone, Serialize)]
|
|
|
|
|
pub struct UserSettings {
|
|
|
|
|
#[serde(skip_serializing)]
|
|
|
|
|
pub user_id: Uuid,
|
|
|
|
|
pub theme: String,
|
|
|
|
|
pub max_age_days: i32,
|
|
|
|
|
@ -23,51 +24,10 @@ pub struct UserSettings {
|
|
|
|
|
pub ai_model_websearch: String,
|
|
|
|
|
pub rate_limit_max_requests: Option<i32>,
|
|
|
|
|
pub rate_limit_time_window_seconds: Option<i32>,
|
|
|
|
|
#[serde(skip_serializing)]
|
|
|
|
|
pub updated_at: DateTime<Utc>,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Response shape for `GET /api/v1/settings`.
|
|
|
|
|
#[derive(Debug, Serialize)]
|
|
|
|
|
pub struct SettingsResponse {
|
|
|
|
|
pub theme: String,
|
|
|
|
|
pub max_age_days: i32,
|
|
|
|
|
pub categories: Vec<String>,
|
|
|
|
|
pub max_items_per_category: i32,
|
|
|
|
|
pub max_articles_per_source: i32,
|
|
|
|
|
pub use_llm_for_source_links: bool,
|
|
|
|
|
pub use_brave_search: bool,
|
|
|
|
|
pub article_history_days: i32,
|
|
|
|
|
pub batch_size: i32,
|
|
|
|
|
pub search_agent_behavior: String,
|
|
|
|
|
pub ai_provider: String,
|
|
|
|
|
pub ai_model: String,
|
|
|
|
|
pub ai_model_websearch: String,
|
|
|
|
|
pub rate_limit_max_requests: Option<i32>,
|
|
|
|
|
pub rate_limit_time_window_seconds: Option<i32>,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl From<UserSettings> for SettingsResponse {
|
|
|
|
|
fn from(s: UserSettings) -> Self {
|
|
|
|
|
Self {
|
|
|
|
|
theme: s.theme,
|
|
|
|
|
max_age_days: s.max_age_days,
|
|
|
|
|
categories: s.categories,
|
|
|
|
|
max_items_per_category: s.max_items_per_category,
|
|
|
|
|
max_articles_per_source: s.max_articles_per_source,
|
|
|
|
|
use_llm_for_source_links: s.use_llm_for_source_links,
|
|
|
|
|
use_brave_search: s.use_brave_search,
|
|
|
|
|
article_history_days: s.article_history_days,
|
|
|
|
|
batch_size: s.batch_size,
|
|
|
|
|
search_agent_behavior: s.search_agent_behavior,
|
|
|
|
|
ai_provider: s.ai_provider,
|
|
|
|
|
ai_model: s.ai_model,
|
|
|
|
|
ai_model_websearch: s.ai_model_websearch,
|
|
|
|
|
rate_limit_max_requests: s.rate_limit_max_requests,
|
|
|
|
|
rate_limit_time_window_seconds: s.rate_limit_time_window_seconds,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Request body for `PUT /api/v1/settings`.
|
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
|
|
|
pub struct UpdateSettingsRequest {
|
|
|
|
|
|