Get queue item (#9)
Reviewed-on: #9
This commit was merged in pull request #9.
This commit is contained in:
+27
-3
@@ -6,17 +6,41 @@ 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;
|
||||
|
||||
let queue = super::queue::Queue {
|
||||
app: self.app.clone(),
|
||||
token: self.token.clone(),
|
||||
};
|
||||
let queue_item: Option<ScheduledMessage> = match queue.get_queue().await {
|
||||
Ok(item) => Some(item),
|
||||
Err(err) => {
|
||||
eprintln!("Error: {err:?}");
|
||||
None
|
||||
}
|
||||
};
|
||||
|
||||
if queue_item.is_none() {
|
||||
println!("No queue item found");
|
||||
return;
|
||||
}
|
||||
let queue_item = queue_item.unwrap();
|
||||
|
||||
println!("Queue item Id: {:?}", queue_item.id);
|
||||
|
||||
todo!(
|
||||
r#"
|
||||
Need to finish this
|
||||
|
||||
This function should fetch a token, check if the token is valid, and obtain a refresh token if
|
||||
[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
|
||||
2. If there is an item, get the data,
|
||||
1. Check the queue - Done
|
||||
2. If there is an item, get the data - Done
|
||||
3. Evaluate if it is schedulable
|
||||
4. Get the events and iterate each one
|
||||
5. starting with the message
|
||||
|
||||
Reference in New Issue
Block a user