Allow notifications to be sent days ahead of time
This commit is contained in:
@@ -13,6 +13,7 @@ pub struct DbChat {
|
||||
last_reminder: Option<i64>,
|
||||
pinned_message: Option<i32>,
|
||||
locale: Option<String>,
|
||||
remind_days_ahead: i64,
|
||||
}
|
||||
|
||||
pub struct ChatInfo<Tz: TimeZone> {
|
||||
@@ -22,6 +23,7 @@ pub struct ChatInfo<Tz: TimeZone> {
|
||||
pub last_reminder: Option<DateTime<Tz>>,
|
||||
pub pinned_message_id: Option<i32>,
|
||||
pub locale: String,
|
||||
pub remind_days_ahead: u64,
|
||||
}
|
||||
|
||||
impl From<DbChat> for ChatInfo<Utc> {
|
||||
@@ -41,6 +43,8 @@ impl From<DbChat> for ChatInfo<Utc> {
|
||||
|
||||
let locale = db_chat.locale.unwrap_or("de".into());
|
||||
|
||||
let remind_days_ahead = db_chat.remind_days_ahead.try_into().unwrap_or(0);
|
||||
|
||||
ChatInfo {
|
||||
id: db_chat.telegram_id,
|
||||
calendar: db_chat.calendar,
|
||||
@@ -48,6 +52,7 @@ impl From<DbChat> for ChatInfo<Utc> {
|
||||
last_reminder,
|
||||
pinned_message_id: db_chat.pinned_message,
|
||||
locale,
|
||||
remind_days_ahead,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user