Git Workflow and Impl ws new item message

This commit is contained in:
2026-03-04 12:21:57 +01:00
parent 61039503d9
commit f463601317
14 changed files with 21 additions and 22 deletions

View File

@@ -74,6 +74,24 @@ pub async fn update_inventory_item(
){
return (StatusCode::INTERNAL_SERVER_ERROR, format!("failed to update inventory history"));
}
if let Some(hotel_users) = state.ws_map.get(&hotel_id) {
let update_msg = json!({
"event_type": "item_update",
"item_id": item_id,
"number": item_amount,
"updated_by": user_id,
})
.to_string();
for entry in hotel_users.iter() {
let sender = entry.value();
// ignore errors (client disconnected)
let _ = sender.send(Message::Text(update_msg.clone().into()));
}
}
(StatusCode::OK, format!("updated item history"))
}
@@ -82,6 +100,9 @@ pub async fn update_inventory_item(
}
/*
match result {
Ok(row) => (StatusCode::OK, format!("Items updated")),