feat: customizable data storage path

This commit is contained in:
Per Stark
2025-05-09 23:28:36 +02:00
parent 89badb3bed
commit c49005c258
16 changed files with 261 additions and 40 deletions

View File

@@ -5,6 +5,7 @@ use common::{storage::db::SurrealDbClient, utils::config::AppConfig};
#[derive(Clone)]
pub struct ApiState {
pub db: Arc<SurrealDbClient>,
pub config: AppConfig,
}
impl ApiState {
@@ -24,6 +25,7 @@ impl ApiState {
let app_state = ApiState {
db: surreal_db_client.clone(),
config: config.clone(),
};
Ok(app_state)

View File

@@ -30,12 +30,9 @@ pub async fn ingest_data(
) -> Result<impl IntoResponse, ApiError> {
info!("Received input: {:?}", input);
let file_infos = try_join_all(
input
.files
.into_iter()
.map(|file| FileInfo::new(file, &state.db, &user.id).map_err(AppError::from)),
)
let file_infos = try_join_all(input.files.into_iter().map(|file| {
FileInfo::new(file, &state.db, &user.id, &state.config).map_err(AppError::from)
}))
.await?;
let payloads = IngestionPayload::create_ingestion_payload(