This commit is contained in:
JMARyA 2024-09-12 10:17:14 +02:00
parent e7fe303941
commit 6f9048e5b1
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
6 changed files with 92 additions and 56 deletions

View file

@ -62,13 +62,13 @@ pub async fn locations_list(
) -> FallibleApiResponse {
check_auth!(t, c);
let mut lst = Vec::with_capacity(locations.len());
let mut ret = HashMap::<String, serde_json::Value>::new();
for id in locations.deref().keys() {
lst.push(id);
for l in locations.iter() {
ret.insert(l.0.clone(), l.1.api().await);
}
Ok(json!(lst))
Ok(json!(ret))
}
#[get("/location_map")]
@ -98,3 +98,16 @@ pub async fn locations_info(
Ok(serde_json::to_value(location_api).unwrap())
}
#[get("/location/<location>/inventory")]
pub async fn location_inventory(
location: &str,
t: Token,
locations: &State<JSONStore<Location>>,
c: &State<Config>,
) -> FallibleApiResponse {
check_auth!(t, c);
// todo : inventory
unimplemented!()
}