From 9d76a20f9c87f4951290349effa516b15e5829fb Mon Sep 17 00:00:00 2001 From: Andre Henriques Date: Sun, 9 Jul 2023 20:27:30 +0100 Subject: [PATCH] added some logging --- src/configure.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/configure.rs b/src/configure.rs index 4bbac87..dd9e217 100644 --- a/src/configure.rs +++ b/src/configure.rs @@ -1,6 +1,6 @@ use r2d2::PooledConnection; use r2d2_sqlite::{SqliteConnectionManager, rusqlite::Statement}; -use rocket::{serde::{json::{Json, serde_json::json, self}, Deserialize, Serialize}, State}; +use rocket::{serde::{json::{Json, serde_json::json}, Deserialize, Serialize}, State}; use crate::{utils::{ApiResponse, get_error_message}, Action, ASender}; use crate::DBPool; @@ -97,8 +97,10 @@ fn prepare_statement<'a>(conn: &'a Conn, stat: &str) -> Result, St fn is_configured(conn: &Conn) -> Result { let mut stmt = prepare_statement(conn, "SELECT configured from meta")?; + + #[derive(Debug)] struct Data { - configured: bool, + configured: u32, } let version_iter = stmt.query_map([], |row| { @@ -118,7 +120,9 @@ fn is_configured(conn: &Conn) -> Result { } for data in version_iter { - if data.unwrap().configured { + let data = data.unwrap(); + println!("{:?}", data); + if data.configured == 1 { return Ok(true); } } @@ -126,8 +130,7 @@ fn is_configured(conn: &Conn) -> Result { } #[get("/configure")] -pub async fn get_configure(db: &State, action: &State>) -> String { - +pub async fn get_configure(db: &State) -> String { let conn = get_conn(db); if let Err(e) = conn { return e;