Enhance SQL insert query for sell logs and improve error logging in TransportWorker: Add sell_timestamp to the insert statement and refine error messages to include transport details for better debugging.

This commit is contained in:
Torsten Schulz (local)
2025-12-20 14:20:09 +01:00
parent 4fca4b4d75
commit 398e0ba677
2 changed files with 15 additions and 8 deletions

View File

@@ -206,8 +206,12 @@ DELETE FROM falukant_data.inventory WHERE id = $1;
"#;
pub const QUERY_ADD_SELL_LOG: &str = r#"
INSERT INTO falukant_log.sell (region_id, product_id, quantity, seller_id) VALUES ($1, $2, $3, $4)
ON CONFLICT (region_id, product_id, seller_id) DO UPDATE SET quantity = falukant_log.sell.quantity + EXCLUDED.quantity;
INSERT INTO falukant_log.sell (region_id, product_id, quantity, seller_id, sell_timestamp)
VALUES ($1, $2, $3, $4, NOW())
ON CONFLICT (region_id, product_id, seller_id)
DO UPDATE SET
quantity = falukant_log.sell.quantity + EXCLUDED.quantity,
sell_timestamp = COALESCE(EXCLUDED.sell_timestamp, NOW());
"#;
pub const QUERY_GET_ARRIVED_TRANSPORTS: &str = r#"
SELECT