use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; use crate::model; #[derive(Debug, Serialize, Deserialize, Clone)] pub struct Alarm { pub enabled: bool, pub time: DateTime, } impl Alarm { pub fn new(enabled: bool, time: DateTime) -> Self { Self { enabled, time } } } impl From for Alarm { fn from(value: model::alarm::Model) -> Self { Self { enabled: value.enabled, time: DateTime::from_utc(value.time, Utc), } } }