Compare commits
No commits in common. "v4" and "main" have entirely different histories.
3355
Cargo.lock
generated
3355
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
12
Cargo.toml
12
Cargo.toml
@ -1,12 +0,0 @@
|
|||||||
[package]
|
|
||||||
edition = "2024"
|
|
||||||
name = "web"
|
|
||||||
version = "0.1.0"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
chrono = { version = "0.4" }
|
|
||||||
fathom-function = { git = "ssh://git@github.com/fathom-io/pipeline-calculations.git", branch = "johnabell/pipeline-route" }
|
|
||||||
pipeline-application = { git = "ssh://git@github.com/fathom-io/pipeline-calculations.git", branch = "johnabell/pipeline-route" }
|
|
||||||
serde = { version = "1.0.219", features = ["derive"] }
|
|
||||||
tokio = { version = "1.43.0", features = ["macros", "rt-multi-thread"] }
|
|
||||||
uuid = { version = "1" }
|
|
||||||
69
src/main.rs
69
src/main.rs
@ -1,69 +0,0 @@
|
|||||||
use chrono::NaiveDate;
|
|
||||||
use fathom_function::Context;
|
|
||||||
use pipeline_application::application::{
|
|
||||||
Application, InlineInspection, InspectionType, ReportType, ToolTolerances,
|
|
||||||
};
|
|
||||||
use serde::{Deserialize, Deserializer};
|
|
||||||
use uuid::Uuid;
|
|
||||||
|
|
||||||
#[fathom_function::function(default(
|
|
||||||
org_id = "2cbfe270-d195-48ad-aed1-24145924635c",
|
|
||||||
project_id = "67c6f36910e4c56ed42bf841"
|
|
||||||
))]
|
|
||||||
async fn pipeline_route(context: Context, input: Input) -> Result<String, String> {
|
|
||||||
Application::new(context.env, context.org_id, &context.project_id)
|
|
||||||
.unwrap()
|
|
||||||
.process_ili_report(
|
|
||||||
uuid::uuid!("0195a527-f16b-7d83-b936-35bc2dd92f9d"),
|
|
||||||
input.file_details.first().unwrap().file_id,
|
|
||||||
ToolTolerances::default(),
|
|
||||||
input,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
Ok("Success".to_owned())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
|
||||||
struct Input {
|
|
||||||
pipeline_id: Vec<Uuid>,
|
|
||||||
#[serde(deserialize_with = "deserialize_date")]
|
|
||||||
date: NaiveDate,
|
|
||||||
vendor_name: String,
|
|
||||||
report_type: ReportType,
|
|
||||||
/// The inspection type and technology used.
|
|
||||||
inspection_type: InspectionType,
|
|
||||||
file_details: Vec<FileDetails>,
|
|
||||||
// TODO: parse the output of the tool tolerances.
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<Input> for InlineInspection {
|
|
||||||
fn from(value: Input) -> Self {
|
|
||||||
Self {
|
|
||||||
date: value.date,
|
|
||||||
vendor_name: value.vendor_name,
|
|
||||||
report_type: value.report_type,
|
|
||||||
inspection_type: value.inspection_type,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Deserialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct FileDetails {
|
|
||||||
pub file_id: Uuid,
|
|
||||||
pub revision_id: Uuid,
|
|
||||||
}
|
|
||||||
|
|
||||||
const FORMAT: &'static str = "%a %b %d %Y";
|
|
||||||
|
|
||||||
pub fn deserialize_date<'de, D>(
|
|
||||||
deserializer: D,
|
|
||||||
) -> Result<NaiveDate, D::Error>
|
|
||||||
where
|
|
||||||
D: Deserializer<'de>,
|
|
||||||
{
|
|
||||||
let s = String::deserialize(deserializer)?;
|
|
||||||
let dt = NaiveDate::parse_from_str(&s, FORMAT).map_err(serde::de::Error::custom)?;
|
|
||||||
Ok(dt)
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user