diff --git a/src/routes/item/mod.rs b/src/routes/item/mod.rs index 1f1d582..2bd97cb 100644 --- a/src/routes/item/mod.rs +++ b/src/routes/item/mod.rs @@ -146,8 +146,18 @@ pub async fn unique_field_route( .ok_or_else(variant_does_not_exist_error)?; match field { - "origin" => Ok(json!(variant.get_unique_origins().await)), - "destination" => Ok(json!(variant.get_unique_destinations().await)), + "origin" => Ok(json!(variant + .get_unique_origins() + .await + .into_iter() + .filter(|x| !x.starts_with("flow::")) + .collect::>())), + "destination" => Ok(json!(variant + .get_unique_destinations() + .await + .into_iter() + .filter(|x| !x.starts_with("flow::")) + .collect::>())), _ => Err(api_error("Unknown field")), } } @@ -196,9 +206,11 @@ pub async fn move_transaction_route(id: &str, form: Json) -> Fa .await .ok_or_else(|| api_error("No such transaction"))? .change() - .location(Some( - reference_of!(Location, new_loc).ok_or_else(|| api_error("No such location"))?, - )) + .location(if form.to.is_empty() { + None + } else { + Some(reference_of!(Location, new_loc).ok_or_else(|| api_error("No such location"))?) + }) .update() .await .unwrap();