Added code to check if queue_item is schedulable
This commit is contained in:
@@ -30,6 +30,13 @@ impl Service {
|
||||
|
||||
println!("Queue item Id: {:?}", queue_item.id);
|
||||
|
||||
if self.is_schedulable(&queue_item) {
|
||||
println!("Can schedule");
|
||||
} else {
|
||||
println!("Not schedulable");
|
||||
return;
|
||||
}
|
||||
|
||||
todo!(
|
||||
r#"
|
||||
Need to finish this
|
||||
@@ -50,4 +57,16 @@ impl Service {
|
||||
"#
|
||||
);
|
||||
}
|
||||
|
||||
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,
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user