update
This commit is contained in:
parent
9135c2f913
commit
132aeee971
2 changed files with 8 additions and 2 deletions
|
@ -143,7 +143,7 @@ pub async fn create_flow_route(
|
|||
}
|
||||
|
||||
#[get("/flow/<id>")]
|
||||
pub async fn flow_api_route(id: &str, flows: &State<JSONStore<FlowInfo>>) -> FallibleApiResponse {
|
||||
pub async fn flow_api_route(id: &str) -> FallibleApiResponse {
|
||||
let flow = Flow::get(id)
|
||||
.await
|
||||
.ok_or_else(|| api_error("No such flow"))?;
|
||||
|
|
|
@ -179,13 +179,19 @@ impl Transaction {
|
|||
|
||||
impl mongod::ToAPI for Transaction {
|
||||
async fn api(&self) -> serde_json::Value {
|
||||
let location = if let Some(loc) = &self.location {
|
||||
Some(loc.get::<Location>().await.api().await)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
json!({
|
||||
"uuid": self._id,
|
||||
"item": self.item,
|
||||
"variant": self.variant,
|
||||
"price": self.price,
|
||||
"origin": self.origin,
|
||||
"location": self.location.as_ref().map(|x| x.id().to_string()),
|
||||
"location": location,
|
||||
"timestamp": self.timestamp,
|
||||
"consumed": self.consumed,
|
||||
"note": self.note,
|
||||
|
|
Loading…
Reference in a new issue