Events (#11)
Reviewed-on: #11
This commit was merged in pull request #11.
This commit is contained in:
+23
-3
@@ -37,6 +37,25 @@ impl Service {
|
||||
|
||||
println!("Can schedule");
|
||||
|
||||
let events_req = super::event::Event {
|
||||
app: self.app.clone(),
|
||||
token: self.token.clone(),
|
||||
};
|
||||
|
||||
let scheduled_message_id = queue_item.id;
|
||||
let events = match events_req.get(&scheduled_message_id).await {
|
||||
Ok(events) => Some(events),
|
||||
Err(err) => {
|
||||
eprintln!("Error: {err:?}");
|
||||
None
|
||||
}
|
||||
};
|
||||
|
||||
let events = events.unwrap_or_default();
|
||||
for event in events {
|
||||
println!("Event: {event:?}");
|
||||
}
|
||||
|
||||
todo!(
|
||||
r#"
|
||||
Need to finish this
|
||||
@@ -48,12 +67,13 @@ impl Service {
|
||||
|
||||
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
|
||||
3. Evaluate if it is schedulable - Done
|
||||
4. Get the events and iterate each one - Done
|
||||
5. starting with the message
|
||||
6. Get the contact
|
||||
7. Send the message
|
||||
8. Record the message event response
|
||||
9. Add to scheduler
|
||||
"#
|
||||
);
|
||||
}
|
||||
@@ -65,7 +85,7 @@ impl Service {
|
||||
let now = time::OffsetDateTime::now_utc();
|
||||
|
||||
match queue_item.scheduled {
|
||||
Some(date) => date <= now,
|
||||
Some(date) => date > now,
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user