fix flows
This commit is contained in:
parent
7b6d58be33
commit
e26c8b3469
7 changed files with 52 additions and 35 deletions
|
@ -123,8 +123,7 @@ pub async fn end_flow_route(id: &str, form: Json<EndFlow>) -> FallibleApiRespons
|
|||
.ok_or_else(|| api_error("Flow not found"))?;
|
||||
|
||||
if let Some(produced) = &form.produced {
|
||||
// todo : add transactions
|
||||
let prod = flow.end_with_produce(produced).await;
|
||||
let prod = flow.end_with_produce(produced).await?;
|
||||
Ok(json!({"produced": prod}))
|
||||
} else {
|
||||
flow.end().await;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
mod demand;
|
||||
mod error;
|
||||
pub mod error;
|
||||
mod location;
|
||||
mod stat;
|
||||
mod supply;
|
||||
|
|
|
@ -6,10 +6,10 @@ use serde_json::json;
|
|||
pub mod flow;
|
||||
pub mod item;
|
||||
|
||||
type ApiError = BadRequest<serde_json::Value>;
|
||||
pub type ApiError = BadRequest<serde_json::Value>;
|
||||
type FallibleApiResponse = Result<serde_json::Value, ApiError>;
|
||||
|
||||
fn api_error(msg: &str) -> ApiError {
|
||||
pub fn api_error(msg: &str) -> ApiError {
|
||||
BadRequest(json!({
|
||||
"error": msg
|
||||
}))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue