Migrate from Event type to CalendarObject

This is preparation to support other calendar components like VTODO and
VJOURNAL
This commit is contained in:
Lennart
2024-09-30 19:35:54 +02:00
parent 41d68f9ae0
commit b3a7806139
14 changed files with 229 additions and 161 deletions

View File

@@ -1,4 +1,4 @@
use crate::event::resource::EventResource;
use crate::calendar_object::resource::CalendarObjectResource;
use crate::Error;
use actix_web::{web::Data, HttpRequest};
use async_trait::async_trait;
@@ -218,7 +218,7 @@ impl Resource for CalendarResource {
#[async_trait(?Send)]
impl<C: CalendarStore + ?Sized> ResourceService for CalendarResourceService<C> {
type MemberType = EventResource;
type MemberType = CalendarObjectResource;
type PathComponents = (String, String); // principal, calendar_id
type Resource = CalendarResource;
type Error = Error;
@@ -243,7 +243,7 @@ impl<C: CalendarStore + ?Sized> ResourceService for CalendarResourceService<C> {
.cal_store
.read()
.await
.get_events(&self.principal, &self.calendar_id)
.get_objects(&self.principal, &self.calendar_id)
.await?
.into_iter()
.map(|event| (format!("{}/{}", self.path, &event.get_uid()), event.into()))