Massive refactoring how DAV resources and routes work

This commit is contained in:
Lennart
2024-10-03 23:02:13 +02:00
parent 9c8c05eaca
commit a47d056df0
15 changed files with 218 additions and 162 deletions

View File

@@ -1,5 +1,5 @@
use crate::Error;
use actix_web::{web::Data, HttpRequest};
use actix_web::{dev::ResourceMap, web::Data, HttpRequest};
use async_trait::async_trait;
use derive_more::derive::{From, Into};
use rustical_dav::resource::{InvalidProperty, Resource, ResourceService};
@@ -51,7 +51,11 @@ impl Resource for CalendarObjectResource {
type Prop = CalendarObjectProp;
type Error = Error;
fn get_prop(&self, _prefix: &str, prop: Self::PropName) -> Result<Self::Prop, Self::Error> {
fn get_prop(
&self,
_rmap: &ResourceMap,
prop: Self::PropName,
) -> Result<Self::Prop, Self::Error> {
Ok(match prop {
CalendarObjectPropName::Getetag => CalendarObjectProp::Getetag(self.0.get_etag()),
CalendarObjectPropName::CalendarData => {
@@ -62,6 +66,11 @@ impl Resource for CalendarObjectResource {
}
})
}
#[inline]
fn resource_name() -> &'static str {
"caldav_calendar_object"
}
}
#[async_trait(?Send)]