Git Workflow and Impl ws new item message
This commit is contained in:
@@ -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"]
|
|
||||||
BIN
db/1.sqlite
BIN
db/1.sqlite
Binary file not shown.
BIN
db/1.sqlite-shm
Normal file
BIN
db/1.sqlite-shm
Normal file
Binary file not shown.
BIN
db/1.sqlite-wal
Normal file
BIN
db/1.sqlite-wal
Normal file
Binary file not shown.
Binary file not shown.
BIN
db/auth_copy_2.sqlite-shm
Normal file
BIN
db/auth_copy_2.sqlite-shm
Normal file
Binary file not shown.
BIN
db/auth_copy_2.sqlite-wal
Normal file
BIN
db/auth_copy_2.sqlite-wal
Normal file
Binary file not shown.
@@ -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.
@@ -74,6 +74,24 @@ pub async fn update_inventory_item(
|
|||||||
){
|
){
|
||||||
return (StatusCode::INTERNAL_SERVER_ERROR, format!("failed to update inventory history"));
|
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"))
|
(StatusCode::OK, format!("updated item history"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,6 +100,9 @@ pub async fn update_inventory_item(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
match result {
|
match result {
|
||||||
Ok(row) => (StatusCode::OK, format!("Items updated")),
|
Ok(row) => (StatusCode::OK, format!("Items updated")),
|
||||||
|
|||||||
Reference in New Issue
Block a user