diff options
author | Joris Guyonvarch | 2025-08-30 09:32:27 +0200 |
---|---|---|
committer | Joris Guyonvarch | 2025-08-30 09:32:27 +0200 |
commit | 2a6bcee45086bca9128489de19908984ea1be0da (patch) | |
tree | 2e5e1b0e50109385b5d3daaabed00efb450f4b62 /src/model | |
parent | 164538a57a5b7c19c993862a6badc85fd723380e (diff) |
Remove weekly report jobmain
Diffstat (limited to 'src/model')
-rw-r--r-- | src/model/config.rs | 4 | ||||
-rw-r--r-- | src/model/job.rs | 1 | ||||
-rw-r--r-- | src/model/mod.rs | 1 | ||||
-rw-r--r-- | src/model/report.rs | 40 |
4 files changed, 0 insertions, 46 deletions
diff --git a/src/model/config.rs b/src/model/config.rs index e0267d5..f40b0fb 100644 --- a/src/model/config.rs +++ b/src/model/config.rs @@ -6,8 +6,6 @@ use std::str::FromStr; pub struct Config { pub auth_secret: String, pub db_path: String, - pub mails_mock: bool, - pub mails_from: String, pub secure_cookies: bool, pub socket_address: SocketAddr, } @@ -16,8 +14,6 @@ pub fn from_env() -> Result<Config, String> { Ok(Config { auth_secret: read_string("AUTH_SECRET")?, db_path: read_string("DB_PATH")?, - mails_mock: read_bool("MAILS_MOCK")?, - mails_from: read_string("MAILS_FROM")?, secure_cookies: read_bool("SECURE_COOKIES")?, socket_address: read_socket_address("SOCKET_ADDRESS")?, }) diff --git a/src/model/job.rs b/src/model/job.rs index f31cfa0..b10b2df 100644 --- a/src/model/job.rs +++ b/src/model/job.rs @@ -3,7 +3,6 @@ use std::fmt; #[derive(Debug)] pub enum Job { MonthlyPayment, - WeeklyReport, } impl fmt::Display for Job { diff --git a/src/model/mod.rs b/src/model/mod.rs index fb07721..55adadd 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -5,5 +5,4 @@ pub mod income; pub mod job; pub mod login; pub mod payment; -pub mod report; pub mod user; diff --git a/src/model/report.rs b/src/model/report.rs deleted file mode 100644 index e944745..0000000 --- a/src/model/report.rs +++ /dev/null @@ -1,40 +0,0 @@ -use rusqlite::types::{FromSql, FromSqlError, FromSqlResult, ValueRef}; -use std::fmt; - -#[derive(Debug, serde::Serialize)] -pub struct Report { - pub date: String, - pub name: String, - pub amount: i64, - pub action: Action, -} - -#[derive(Debug, PartialEq, serde::Serialize)] -pub enum Action { - Created, - Updated, - Deleted, -} - -impl fmt::Display for Action { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{:?}", self) - } -} - -impl FromSql for Action { - fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self> { - match value { - ValueRef::Text(text) => match std::str::from_utf8(text) { - Ok("Created") => Ok(Action::Created), - Ok("Updated") => Ok(Action::Updated), - Ok("Deleted") => Ok(Action::Deleted), - Ok(str) => Err(FromSqlError::Other( - format!("Unknown action: {str}").into(), - )), - Err(err) => Err(FromSqlError::Other(err.into())), - }, - _ => Err(FromSqlError::InvalidType), - } - } -} |