40 lines
937 B
Rust
40 lines
937 B
Rust
use pipeline_application::application::{Application, Env};
|
|
use serde::{Deserialize, Serialize};
|
|
use uuid::Uuid;
|
|
|
|
// There is an issue with the data form component at the moment and its giving back
|
|
// a null value
|
|
const DEFAULT_PROJECT_ID: &str = "680b61b0aedd6f9e639d8699";
|
|
|
|
#[fathom_function::function]
|
|
async fn pipeline_route(input: Input) -> Result<Output, String> {
|
|
let app = Application::new(
|
|
Env::Dev,
|
|
input.org_id,
|
|
input.project_id.as_deref().unwrap_or(DEFAULT_PROJECT_ID),
|
|
)
|
|
.unwrap();
|
|
|
|
for pipeline_id in input.pipeline_id {
|
|
app.update_assets_with_geo_locations(pipeline_id)
|
|
.await
|
|
.unwrap();
|
|
}
|
|
|
|
Ok(Output {
|
|
status: "Success".to_owned(),
|
|
})
|
|
}
|
|
|
|
#[derive(Debug, Serialize)]
|
|
struct Output {
|
|
status: String,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
struct Input {
|
|
org_id: Uuid,
|
|
project_id: Option<String>,
|
|
pipeline_id: Vec<Uuid>,
|
|
}
|