webs unified

This commit is contained in:
Priec
2026-08-03 13:32:25 +02:00
parent 35d85de556
commit c8afe99d79
59 changed files with 1991 additions and 952 deletions

View File

@@ -0,0 +1,68 @@
use serde::Deserialize;
use serde_json::Value;
#[derive(Deserialize)]
pub(crate) struct QueryInput {
pub profile_name: String,
pub sql: String,
#[serde(default = "default_max_rows")]
pub max_rows: u32,
pub chart_type: String,
}
fn default_max_rows() -> u32 {
1000
}
#[derive(Deserialize)]
pub(crate) struct CatalogInput {
pub profile_name: String,
}
/// One entry of the profile `<select>` on the analytics page.
pub(crate) struct ProfileOption {
pub name: String,
pub table_count: usize,
}
pub(crate) struct QueryOutput {
pub columns: Vec<ColumnOutput>,
pub rows: Vec<Vec<Value>>,
pub row_count: u64,
pub elapsed_ms: u64,
pub truncated: bool,
}
pub(crate) struct ColumnOutput {
pub name: String,
#[allow(dead_code)]
pub data_type: String,
}
/// The catalog sidebar, already shaped for `catalog.html` so the
/// template holds no SQL-quoting or label-building logic.
pub(crate) struct CatalogView {
pub tables: Vec<CatalogTableView>,
pub llm_context: String,
}
pub(crate) struct CatalogTableView {
pub name: String,
pub base_currency: String,
pub starter_query: String,
pub columns: Vec<CatalogColumnView>,
pub links: Vec<CatalogLinkView>,
}
pub(crate) struct CatalogColumnView {
pub name: String,
/// The quoted identifier inserted into the SQL box when clicked.
pub insert_text: String,
pub details: String,
}
pub(crate) struct CatalogLinkView {
pub source_column: String,
pub linked_table: String,
pub required: bool,
}