This commit is contained in:
JMARyA 2024-09-21 18:58:24 +02:00
parent ad96e2938d
commit c68f871f4d
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
3 changed files with 29 additions and 26 deletions

View file

@ -1,6 +1,6 @@
use std::collections::HashMap;
use mongod::{vec_to_api, ToAPI};
use mongod::{reference_of, vec_to_api, Model, ToAPI};
use rocket::{get, State};
use serde_json::json;
@ -109,6 +109,9 @@ pub async fn location_inventory(
) -> FallibleApiResponse {
check_auth!(t, c);
let location =
reference_of!(Location, location).ok_or_else(|| api_error("No such location"))?;
if let Some("true" | "yes" | "1") = recursive {
return Ok(json!(
vec_to_api(&Transaction::in_location_recursive(location).await).await