mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 02:22:21 +00:00
calendar: refactoring
This commit is contained in:
@@ -90,7 +90,6 @@ impl InvalidProperty for CalendarProp {
|
|||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct CalendarFile {
|
pub struct CalendarFile {
|
||||||
pub calendar: Calendar,
|
pub calendar: Calendar,
|
||||||
pub principal: String,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Resource for CalendarFile {
|
impl Resource for CalendarFile {
|
||||||
@@ -102,11 +101,11 @@ impl Resource for CalendarFile {
|
|||||||
Ok(match prop {
|
Ok(match prop {
|
||||||
CalendarPropName::Resourcetype => CalendarProp::Resourcetype(Resourcetype::default()),
|
CalendarPropName::Resourcetype => CalendarProp::Resourcetype(Resourcetype::default()),
|
||||||
CalendarPropName::CurrentUserPrincipal => CalendarProp::CurrentUserPrincipal(
|
CalendarPropName::CurrentUserPrincipal => CalendarProp::CurrentUserPrincipal(
|
||||||
HrefElement::new(format!("{}/user/{}/", prefix, self.principal)),
|
HrefElement::new(format!("{}/user/{}/", prefix, self.calendar.principal)),
|
||||||
),
|
),
|
||||||
CalendarPropName::Owner => CalendarProp::Owner(HrefElement::new(format!(
|
CalendarPropName::Owner => CalendarProp::Owner(HrefElement::new(format!(
|
||||||
"{}/user/{}/",
|
"{}/user/{}/",
|
||||||
prefix, self.principal
|
prefix, self.calendar.principal
|
||||||
))),
|
))),
|
||||||
CalendarPropName::Displayname => {
|
CalendarPropName::Displayname => {
|
||||||
CalendarProp::Displayname(self.calendar.displayname.clone())
|
CalendarProp::Displayname(self.calendar.displayname.clone())
|
||||||
@@ -248,10 +247,7 @@ impl<C: CalendarStore + ?Sized> ResourceService for CalendarResource<C> {
|
|||||||
.get_calendar(&self.principal, &self.calendar_id)
|
.get_calendar(&self.principal, &self.calendar_id)
|
||||||
.await
|
.await
|
||||||
.map_err(|_e| Error::NotFound)?;
|
.map_err(|_e| Error::NotFound)?;
|
||||||
Ok(CalendarFile {
|
Ok(CalendarFile { calendar })
|
||||||
calendar,
|
|
||||||
principal: self.principal.to_owned(),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_members(
|
async fn get_members(
|
||||||
|
|||||||
Reference in New Issue
Block a user