231fb65bc5a3401a8ebfb18b169.../src/main.rs
2025-07-31 09:22:35 +00:00

35 lines
872 B
Rust

use fathom_function::tracing;
use pipeline_application::application::Application;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
#[fathom_function::function]
async fn facility_locations(input: Input) -> Result<Output, String> {
let app = Application::new_from_compile_env(input.org_id, input.project_id).unwrap();
for pipeline_id in input.pipeline_id {
app.update_assets_with_geo_locations(pipeline_id)
.await
.map_err(|err| {
tracing::error!(%pipeline_id, ?err, "Error updating facility locations");
format!("{err:?}")
})?;
}
Ok(Output {
status: "Success".to_owned(),
})
}
#[derive(Debug, Serialize)]
struct Output {
status: String,
}
#[derive(Debug, Deserialize)]
struct Input {
org_id: Uuid,
project_id: String,
pipeline_id: Vec<Uuid>,
}