From b017ed71438a3ba7bf19a2062a2b3d1153b707d0 Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 6 Jul 2026 22:50:43 -0400 Subject: [PATCH] Code refactoring --- src/app.rs | 2 -- src/service/core.rs | 28 +--------------------------- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/src/app.rs b/src/app.rs index fdfe8a7..7d840e7 100644 --- a/src/app.rs +++ b/src/app.rs @@ -12,8 +12,6 @@ pub struct App { pub twilio_config: textsender_models::config::auxiliary::TwilioConfig, } -// TODO: Change this to non-async at some point. -// Will require changes in other libraries pub fn load_app() -> Result { use textsender_models::envy; let auth_url_env = envy::environment::get_env("AUTH_URL"); diff --git a/src/service/core.rs b/src/service/core.rs index 969f22d..195bf88 100644 --- a/src/service/core.rs +++ b/src/service/core.rs @@ -5,7 +5,6 @@ pub struct Service { impl Service { pub async fn do_the_work(&mut self) { - println!("Do some work"); println!("Checking queue"); use textsender_models::message::scheduling::ScheduledMessage; @@ -148,39 +147,14 @@ impl Service { } } } - - /* - todo!( - r#" - Need to finish this - - [X] - This function should fetch a token, check if the token is valid, and obtain a refresh token if - it has expired. - - Then do the real work. - - 1. Check the queue - Done - 2. If there is an item, get the data - Done - 3. Evaluate if it is schedulable - Done - 4. Get the events and iterate each one - Done - 5. Starting with the message - Done - 6. Get the contact - Done - 7. Send the message - 8. Record the message event response - Added, not used - 9. Add to scheduler - "# - ); - */ } fn is_schedulable( &self, queue_item: &textsender_models::message::scheduling::ScheduledMessage, ) -> bool { - let now = time::OffsetDateTime::now_utc(); - match queue_item.scheduled { - Some(date) => date > now, + Some(date) => date > time::OffsetDateTime::now_utc(), None => false, } }