Refactor SQL queries into centralized module

- Moved various SQL query strings from individual worker files into a new `sql.rs` module for better organization and reusability.
- Updated `events.rs`, `underground.rs`, and `weather.rs` to use the centralized SQL queries.
- Removed redundant query definitions from `events.rs`, `underground.rs`, and `weather.rs`.
This commit is contained in:
Torsten Schulz (local)
2025-12-12 15:18:30 +01:00
parent eab46f5cdc
commit a9d490ce38
7 changed files with 401 additions and 667 deletions

View File

@@ -11,6 +11,7 @@ use std::sync::Arc;
use std::time::Duration;
use super::base::{BaseWorker, Worker, WorkerState};
use crate::worker::sql::QUERY_UPDATE_MONEY;
pub struct UndergroundWorker {
base: BaseWorker,
@@ -118,10 +119,7 @@ const Q_SELECT_FALUKANT_USER: &str = r#"
LIMIT 1;
"#;
// Query für Geldänderungen (lokale Variante von BaseWorker::change_falukant_user_money)
const QUERY_UPDATE_MONEY: &str = r#"
SELECT falukant_data.update_money($1, $2, $3);
"#;
// Use centralized QUERY_UPDATE_MONEY from src/worker/sql.rs
impl UndergroundWorker {
pub fn new(pool: ConnectionPool, broker: MessageBroker) -> Self {