rustical_dav_push/subscription.rs
1use chrono::{DateTime, NaiveDateTime, TimeZone};
2
3pub struct Subscription {
4 pub id: String,
5 pub topic: String,
6 // Naive because sqlite has no concept of timezones
7 // In reality, this is UTC
8 pub expiration: NaiveDateTime,
9 pub push_resource: String,
10 pub public_key: String,
11 pub public_key_type: String,
12 pub auth_secret: String,
13}
14
15impl Subscription {
16 #[must_use]
17 pub fn is_expired(&self, now: &DateTime<impl TimeZone>) -> bool {
18 self.expiration < now.naive_utc()
19 }
20}