multi-hotel-refactor #3

Merged
Rominou merged 27 commits from multi-hotel-refactor into master 2026-03-11 13:32:43 +00:00
14 changed files with 21 additions and 22 deletions
Showing only changes of commit f463601317 - Show all commits

View File

@@ -1,16 +0,0 @@
FROM rust:latest AS builder
WORKDIR /app
COPY . .
RUN cargo build --release
FROM debian:bookworm-slim
WORKDIR /app
COPY --from=builder /app/target/release/hotel-api-rs /usr/local/bin/hotel-api-rs
# Create the directory where DB will be stored
RUN mkdir -p /db
# Expose API port
EXPOSE 8080
CMD ["/usr/local/bin/hotel-api-rs"]

Binary file not shown.

BIN
db/1.sqlite-shm Normal file

Binary file not shown.

BIN
db/1.sqlite-wal Normal file

Binary file not shown.

Binary file not shown.

BIN
db/auth_copy_2.sqlite-shm Normal file

Binary file not shown.

BIN
db/auth_copy_2.sqlite-wal Normal file

Binary file not shown.

View File

View File

View File

@@ -1,6 +0,0 @@
id INT
user_id INTEGER NOT NULL,
token_hash TEXT NOT NULL,
device_id TEXT NOT NULL,
user_agent TEXT NOT NULL,
hotel_id TEXT

Binary file not shown.

Binary file not shown.

Binary file not shown.

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")),