Fix issue with exporting

This commit is contained in:
jude 2024-10-21 18:50:06 +01:00
parent eb5c851d97
commit 33e85dc44d
5 changed files with 9 additions and 24 deletions

2
Cargo.lock generated
View File

@ -2462,7 +2462,7 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
[[package]] [[package]]
name = "reminder-rs" name = "reminder-rs"
version = "1.7.31" version = "1.7.32"
dependencies = [ dependencies = [
"base64 0.22.1", "base64 0.22.1",
"chrono", "chrono",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "reminder-rs" name = "reminder-rs"
version = "1.7.31" version = "1.7.32"
authors = ["Jude Southworth <judesouthworth@pm.me>"] authors = ["Jude Southworth <judesouthworth@pm.me>"]
edition = "2021" edition = "2021"
license = "AGPL-3.0 only" license = "AGPL-3.0 only"

View File

@ -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;

View File

@ -77,12 +77,6 @@ pub struct Data {
_broadcast: Sender<()>, _broadcast: Sender<()>,
} }
impl Debug for Data {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "Data {{ .. }}")
}
}
struct Ended; struct Ended;
impl Debug for Ended { impl Debug for Ended {
@ -128,9 +122,9 @@ async fn _main(tx: Sender<()>) -> Result<(), Box<dyn StdError + Send + Sync>> {
match cmd_word { match cmd_word {
Some("clean") => { 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() { if sent_clean_age.is_empty() {
panic!("No SENT_CLEAN_AGE") panic!("SENT_CLEAN_AGE empty")
} }
sqlx::query!( sqlx::query!(
" "

View File

@ -79,8 +79,11 @@ pub async fn export_reminders(
" "
); );
let result = let mut query = sqlx::query_as::<Database, ReminderCsv>(&sql);
sqlx::query_as::<Database, ReminderCsv>(&sql).fetch_all(pool.inner()).await; for channel in channels {
query = query.bind(channel);
}
let result = query.fetch_all(pool.inner()).await;
match result { match result {
Ok(reminders) => { Ok(reminders) => {