diff --git a/Cargo.lock b/Cargo.lock index 0b6c92c..d6e9d6e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2462,7 +2462,7 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "reminder-rs" -version = "1.7.31" +version = "1.7.32" dependencies = [ "base64 0.22.1", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 49e4fbe..2b0ab07 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reminder-rs" -version = "1.7.31" +version = "1.7.32" authors = ["Jude Southworth "] edition = "2021" license = "AGPL-3.0 only" diff --git a/bin/reminder-rs-clean-old b/bin/reminder-rs-clean-old deleted file mode 100755 index 7b0739d..0000000 --- a/bin/reminder-rs-clean-old +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -# Load environment -source /etc/reminder-rs/config.env - -if [ -z "${SENT_CLEAN_AGE}" ]; then - mysql -D reminders -e "DELETE FROM reminders WHERE status != 'pending' AND \`utc_time\` < NOW() - INTERVAL ${SENT_CLEAN_AGE} MONTH" -fi; - -if [ -z "${TOTAL_CLEAN_AGE}" ]; then - mysql -D reminders -e "DELETE FROM reminders WHERE \`utc_time\` < NOW() - INTERVAL ${TOTAL_CLEAN_AGE} MONTH" -fi; diff --git a/src/main.rs b/src/main.rs index 8f9cae4..9bc776f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -77,12 +77,6 @@ pub struct Data { _broadcast: Sender<()>, } -impl Debug for Data { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - write!(f, "Data {{ .. }}") - } -} - struct Ended; impl Debug for Ended { @@ -128,9 +122,9 @@ async fn _main(tx: Sender<()>) -> Result<(), Box> { match cmd_word { Some("clean") => { - let sent_clean_age = env::var("SENT_CLEAN_AGE")?; + let sent_clean_age = env::var("SENT_CLEAN_AGE").expect("No SENT_CLEAN_AGE provided"); if sent_clean_age.is_empty() { - panic!("No SENT_CLEAN_AGE") + panic!("SENT_CLEAN_AGE empty") } sqlx::query!( " diff --git a/src/web/routes/dashboard/export.rs b/src/web/routes/dashboard/export.rs index ba361a9..4e096f1 100644 --- a/src/web/routes/dashboard/export.rs +++ b/src/web/routes/dashboard/export.rs @@ -79,8 +79,11 @@ pub async fn export_reminders( " ); - let result = - sqlx::query_as::(&sql).fetch_all(pool.inner()).await; + let mut query = sqlx::query_as::(&sql); + for channel in channels { + query = query.bind(channel); + } + let result = query.fetch_all(pool.inner()).await; match result { Ok(reminders) => {