get endpoint works
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use chrono::{DateTime, Local, Timelike};
|
||||
use chrono::{DateTime, Local, Timelike, Utc};
|
||||
use cron_tab::Cron;
|
||||
use sea_orm::{DatabaseConnection, DbErr};
|
||||
|
||||
@@ -48,7 +48,7 @@ impl Scheduler {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn add_alarm(&self, time: DateTime<Local>) -> Result<Alarm, String> {
|
||||
pub async fn add_alarm(&self, time: DateTime<Utc>) -> Result<Alarm, String> {
|
||||
let cron_schedule = format!("{} {} {} * * *", "*", time.minute(), time.hour());
|
||||
let alarm = Alarm::new(true, time);
|
||||
|
||||
@@ -63,7 +63,12 @@ impl Scheduler {
|
||||
}
|
||||
|
||||
pub async fn get_alarms(&self, enabled: Option<bool>) -> Result<Vec<Alarm>, DbErr> {
|
||||
get_alarms(&*self.db, enabled).await.map(|a| a.into())
|
||||
get_alarms(&*self.db, enabled).await
|
||||
.map(|alarms| alarms
|
||||
.into_iter()
|
||||
.map(|a| a.into())
|
||||
.collect()
|
||||
)
|
||||
}
|
||||
|
||||
pub fn start(&self) {
|
||||
|
||||
Reference in New Issue
Block a user