added some logging
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Andre Henriques 2023-07-09 20:27:30 +01:00
parent d9e9a33b3d
commit 9d76a20f9c

View File

@ -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<Statement<'a>, St
fn is_configured(conn: &Conn) -> Result<bool, String> {
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<bool, String> {
}
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<bool, String> {
}
#[get("/configure")]
pub async fn get_configure(db: &State<DBPool>, action: &State<ASender<Action>>) -> String {
pub async fn get_configure(db: &State<DBPool>) -> String {
let conn = get_conn(db);
if let Err(e) = conn {
return e;