update
This commit is contained in:
parent
9468629302
commit
012e5273b1
1 changed files with 17 additions and 5 deletions
|
@ -146,8 +146,18 @@ pub async fn unique_field_route(
|
||||||
.ok_or_else(variant_does_not_exist_error)?;
|
.ok_or_else(variant_does_not_exist_error)?;
|
||||||
|
|
||||||
match field {
|
match field {
|
||||||
"origin" => Ok(json!(variant.get_unique_origins().await)),
|
"origin" => Ok(json!(variant
|
||||||
"destination" => Ok(json!(variant.get_unique_destinations().await)),
|
.get_unique_origins()
|
||||||
|
.await
|
||||||
|
.into_iter()
|
||||||
|
.filter(|x| !x.starts_with("flow::"))
|
||||||
|
.collect::<Vec<_>>())),
|
||||||
|
"destination" => Ok(json!(variant
|
||||||
|
.get_unique_destinations()
|
||||||
|
.await
|
||||||
|
.into_iter()
|
||||||
|
.filter(|x| !x.starts_with("flow::"))
|
||||||
|
.collect::<Vec<_>>())),
|
||||||
_ => Err(api_error("Unknown field")),
|
_ => Err(api_error("Unknown field")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -196,9 +206,11 @@ pub async fn move_transaction_route(id: &str, form: Json<MoveTransaction>) -> Fa
|
||||||
.await
|
.await
|
||||||
.ok_or_else(|| api_error("No such transaction"))?
|
.ok_or_else(|| api_error("No such transaction"))?
|
||||||
.change()
|
.change()
|
||||||
.location(Some(
|
.location(if form.to.is_empty() {
|
||||||
reference_of!(Location, new_loc).ok_or_else(|| api_error("No such location"))?,
|
None
|
||||||
))
|
} else {
|
||||||
|
Some(reference_of!(Location, new_loc).ok_or_else(|| api_error("No such location"))?)
|
||||||
|
})
|
||||||
.update()
|
.update()
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
Loading…
Reference in a new issue