calendar: implement get_members

This commit is contained in:
Lennart
2024-06-20 20:35:07 +02:00
parent 420a8b786e
commit edb5cbd530

View File

@@ -1,3 +1,4 @@
use crate::event::resource::EventFile;
use crate::Error; use crate::Error;
use actix_web::{web::Data, HttpRequest}; use actix_web::{web::Data, HttpRequest};
use anyhow::anyhow; use anyhow::anyhow;
@@ -268,7 +269,7 @@ impl Resource for CalendarFile {
#[async_trait(?Send)] #[async_trait(?Send)]
impl<C: CalendarStore + ?Sized> ResourceService for CalendarResource<C> { impl<C: CalendarStore + ?Sized> ResourceService for CalendarResource<C> {
type MemberType = CalendarFile; type MemberType = EventFile;
type PathComponents = (String, String); // principal, calendar_id type PathComponents = (String, String); // principal, calendar_id
type File = CalendarFile; type File = CalendarFile;
type Error = Error; type Error = Error;
@@ -293,7 +294,18 @@ impl<C: CalendarStore + ?Sized> ResourceService for CalendarResource<C> {
_auth_info: AuthInfo, _auth_info: AuthInfo,
) -> Result<Vec<Self::MemberType>, Self::Error> { ) -> Result<Vec<Self::MemberType>, Self::Error> {
// As of now the calendar resource has no members since events are shown with REPORT // As of now the calendar resource has no members since events are shown with REPORT
Ok(vec![]) Ok(self
.cal_store
.read()
.await
.get_events(&self.calendar_id)
.await?
.into_iter()
.map(|event| EventFile {
path: format!("{}/{}", self.path, &event.get_uid()),
event,
})
.collect())
} }
async fn new( async fn new(