{flake.lock,Cargo.*}: bump
This commit is contained in:
Generated
+413
-689
File diff suppressed because it is too large
Load Diff
+11
-11
@@ -4,16 +4,16 @@ version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.100"
|
||||
axum = "0.8.8"
|
||||
chrono = { version = "0.4.42", features = ["serde"] }
|
||||
clap = { version = "4.5.53", features = ["derive"] }
|
||||
anyhow = "1.0.104"
|
||||
axum = "0.8.9"
|
||||
chrono = { version = "0.4.45", features = ["serde"] }
|
||||
clap = { version = "4.6.2", features = ["derive"] }
|
||||
indoc = "2.0.7"
|
||||
itertools = "0.14.0"
|
||||
serde = { version = "1.0.228", features = ["derive"] }
|
||||
serde_json = "1.0.145"
|
||||
sqlx = { version = "0.8.6", features = ["bigdecimal", "chrono", "postgres", "runtime-tokio"] }
|
||||
tokio = { version = "1.48.0", features = ["rt-multi-thread"] }
|
||||
toml = "0.9.10"
|
||||
itertools = "0.15.0"
|
||||
serde = { version = "1.0.229", features = ["derive"] }
|
||||
serde_json = "1.0.151"
|
||||
sqlx = { version = "0.9.0", features = ["bigdecimal", "chrono", "postgres", "runtime-tokio"] }
|
||||
tokio = { version = "1.53.0", features = ["rt-multi-thread"] }
|
||||
toml = "1.1.3"
|
||||
tracing = "0.1.44"
|
||||
tracing-subscriber = { version = "0.3.22", features = ["env-filter"] }
|
||||
tracing-subscriber = { version = "0.3.23", features = ["env-filter"] }
|
||||
|
||||
@@ -43,7 +43,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
|
||||
let config_content = std::fs::read_to_string(&args.config_path).context(format!(
|
||||
"Failed to read configuration file at '{}'",
|
||||
&args.config_path
|
||||
args.config_path
|
||||
))?;
|
||||
|
||||
let config: Config =
|
||||
@@ -128,7 +128,7 @@ async fn seed_test_data(_config: Config, db_pool: sqlx::PgPool) -> anyhow::Resul
|
||||
|
||||
tracing::info!("Inserting test data...");
|
||||
|
||||
let test_data = vec![
|
||||
let test_data = [
|
||||
("player1", "2023-10-01 10:00:00", 3600),
|
||||
("player2", "2023-10-01 11:00:00", 1800),
|
||||
("player1", "2023-10-02 09:30:00", 7200),
|
||||
|
||||
@@ -23,7 +23,7 @@ pub struct LoginSession {
|
||||
}
|
||||
|
||||
async fn filter_time(
|
||||
query_builder: &mut QueryBuilder<'_, sqlx::Postgres>,
|
||||
query_builder: &mut QueryBuilder<sqlx::Postgres>,
|
||||
start_time: Option<chrono::NaiveDateTime>,
|
||||
end_time: Option<chrono::NaiveDateTime>,
|
||||
) {
|
||||
|
||||
@@ -11,14 +11,12 @@ use serde_json::json;
|
||||
use crate::queries::{get_login_sessions, get_total_login_time, get_user_login_times};
|
||||
|
||||
pub async fn create_router(db_pool: sqlx::PgPool) -> Router {
|
||||
let app = Router::new()
|
||||
Router::new()
|
||||
.route("/ping", get(handle_ping))
|
||||
.route("/login_sessions", get(handle_login_sessions))
|
||||
.route("/total_login_time", get(handle_total_login_time))
|
||||
.route("/user_login_time", get(handle_user_login_time))
|
||||
.with_state(db_pool);
|
||||
|
||||
app
|
||||
.with_state(db_pool)
|
||||
}
|
||||
|
||||
async fn handle_ping() -> impl IntoResponse {
|
||||
@@ -43,8 +41,7 @@ async fn handle_login_sessions(
|
||||
Json(response).into_response()
|
||||
}
|
||||
Err(e) => {
|
||||
let response =
|
||||
json!({ "error": format!("Failed to retrieve login sessions: {}", e) });
|
||||
let response = json!({ "error": format!("Failed to retrieve login sessions: {}", e) });
|
||||
(
|
||||
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
||||
Json(response),
|
||||
|
||||
Reference in New Issue
Block a user