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)?;
|
||||
|
||||
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::<Vec<_>>())),
|
||||
"destination" => Ok(json!(variant
|
||||
.get_unique_destinations()
|
||||
.await
|
||||
.into_iter()
|
||||
.filter(|x| !x.starts_with("flow::"))
|
||||
.collect::<Vec<_>>())),
|
||||
_ => Err(api_error("Unknown field")),
|
||||
}
|
||||
}
|
||||
|
@ -196,9 +206,11 @@ pub async fn move_transaction_route(id: &str, form: Json<MoveTransaction>) -> 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();
|
||||
|
|
Loading…
Reference in a new issue