calendar store: Add method for bulk insert

This commit is contained in:
Lennart K
2025-12-20 11:48:05 +01:00
parent b50ea478db
commit 28c925301e
4 changed files with 40 additions and 26 deletions

View File

@@ -77,13 +77,23 @@ pub trait CalendarStore: Send + Sync + 'static {
object_id: &str,
show_deleted: bool,
) -> Result<CalendarObject, Error>;
async fn put_objects(
&self,
principal: String,
cal_id: String,
objects: Vec<CalendarObject>,
overwrite: bool,
) -> Result<(), Error>;
async fn put_object(
&self,
principal: String,
cal_id: String,
object: CalendarObject,
overwrite: bool,
) -> Result<(), Error>;
) -> Result<(), Error> {
self.put_objects(principal, cal_id, vec![object], overwrite)
.await
}
async fn delete_object(
&self,
principal: &str,

View File

@@ -147,15 +147,15 @@ impl CalendarStore for CombinedCalendarStore {
.await
}
async fn put_object(
async fn put_objects(
&self,
principal: String,
cal_id: String,
object: rustical_ical::CalendarObject,
objects: Vec<rustical_ical::CalendarObject>,
overwrite: bool,
) -> Result<(), crate::Error> {
self.store_for_id(&cal_id)
.put_object(principal, cal_id, object, overwrite)
.put_objects(principal, cal_id, objects, overwrite)
.await
}