mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-19 03:49:25 +00:00
Dav Push: Logic to register subscriptions
This commit is contained in:
20
crates/caldav/src/subscription.rs
Normal file
20
crates/caldav/src/subscription.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use actix_web::{
|
||||
web::{self, Data, Path},
|
||||
HttpResponse,
|
||||
};
|
||||
use rustical_store::SubscriptionStore;
|
||||
|
||||
async fn handle_delete<S: SubscriptionStore + ?Sized>(
|
||||
store: Data<S>,
|
||||
path: Path<String>,
|
||||
) -> Result<HttpResponse, rustical_store::Error> {
|
||||
let id = path.into_inner();
|
||||
store.delete_subscription(&id).await?;
|
||||
Ok(HttpResponse::NoContent().body("Unregistered"))
|
||||
}
|
||||
|
||||
pub fn subscription_resource<S: SubscriptionStore + ?Sized>() -> actix_web::Resource {
|
||||
web::resource("/subscription/{id}")
|
||||
.name("subscription")
|
||||
.delete(handle_delete::<S>)
|
||||
}
|
||||
Reference in New Issue
Block a user