mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 10:32:19 +00:00
Dav Push: Logic to register subscriptions
This commit is contained in:
@@ -6,11 +6,13 @@ pub use error::Error;
|
||||
pub mod auth;
|
||||
pub mod calendar;
|
||||
mod contact_birthday_store;
|
||||
mod subscription_store;
|
||||
pub mod synctoken;
|
||||
|
||||
pub use addressbook_store::AddressbookStore;
|
||||
pub use calendar_store::CalendarStore;
|
||||
pub use contact_birthday_store::ContactBirthdayStore;
|
||||
pub use subscription_store::*;
|
||||
|
||||
pub use addressbook::{AddressObject, Addressbook};
|
||||
pub use calendar::{Calendar, CalendarObject};
|
||||
|
||||
19
crates/store/src/subscription_store.rs
Normal file
19
crates/store/src/subscription_store.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use crate::Error;
|
||||
use async_trait::async_trait;
|
||||
use chrono::NaiveDateTime;
|
||||
|
||||
pub struct Subscription {
|
||||
pub id: String,
|
||||
pub topic: String,
|
||||
pub expiration: NaiveDateTime,
|
||||
pub push_resource: String,
|
||||
}
|
||||
|
||||
#[async_trait(?Send)]
|
||||
pub trait SubscriptionStore: Send + Sync + 'static {
|
||||
async fn get_subscriptions(&self, topic: &str) -> Result<Vec<Subscription>, Error>;
|
||||
async fn get_subscription(&self, id: &str) -> Result<Subscription, Error>;
|
||||
/// Returns whether a subscription under the id already existed
|
||||
async fn upsert_subscription(&self, sub: Subscription) -> Result<bool, Error>;
|
||||
async fn delete_subscription(&self, id: &str) -> Result<(), Error>;
|
||||
}
|
||||
Reference in New Issue
Block a user