mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 11:42:25 +00:00
calendar: implement get_members
This commit is contained in:
@@ -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(
|
||||||
|
|||||||
Reference in New Issue
Block a user