mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-29 09:29:11 +00:00
Make CalendarObject id an extrinsic property
This commit is contained in:
@@ -37,7 +37,7 @@ pub trait CalendarStore: Send + Sync + 'static {
|
||||
async fn import_calendar(
|
||||
&self,
|
||||
calendar: Calendar,
|
||||
objects: Vec<CalendarObject>,
|
||||
objects: Vec<(String, CalendarObject)>,
|
||||
merge_existing: bool,
|
||||
) -> Result<(), Error>;
|
||||
|
||||
@@ -46,7 +46,7 @@ pub trait CalendarStore: Send + Sync + 'static {
|
||||
principal: &str,
|
||||
cal_id: &str,
|
||||
synctoken: i64,
|
||||
) -> Result<(Vec<CalendarObject>, Vec<String>, i64), Error>;
|
||||
) -> Result<(Vec<(String, CalendarObject)>, Vec<String>, i64), Error>;
|
||||
|
||||
/// Since the <calendar-query> rules are rather complex this function
|
||||
/// is only meant to do some prefiltering
|
||||
@@ -55,7 +55,7 @@ pub trait CalendarStore: Send + Sync + 'static {
|
||||
principal: &str,
|
||||
cal_id: &str,
|
||||
_query: CalendarQuery,
|
||||
) -> Result<Vec<CalendarObject>, Error> {
|
||||
) -> Result<Vec<(String, CalendarObject)>, Error> {
|
||||
self.get_objects(principal, cal_id).await
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ pub trait CalendarStore: Send + Sync + 'static {
|
||||
&self,
|
||||
principal: &str,
|
||||
cal_id: &str,
|
||||
) -> Result<Vec<CalendarObject>, Error>;
|
||||
) -> Result<Vec<(String, CalendarObject)>, Error>;
|
||||
async fn get_object(
|
||||
&self,
|
||||
principal: &str,
|
||||
@@ -81,14 +81,14 @@ pub trait CalendarStore: Send + Sync + 'static {
|
||||
&self,
|
||||
principal: String,
|
||||
cal_id: String,
|
||||
objects: Vec<CalendarObject>,
|
||||
objects: Vec<(String, CalendarObject)>,
|
||||
overwrite: bool,
|
||||
) -> Result<(), Error>;
|
||||
async fn put_object(
|
||||
&self,
|
||||
principal: String,
|
||||
cal_id: String,
|
||||
object: CalendarObject,
|
||||
object: (String, CalendarObject),
|
||||
overwrite: bool,
|
||||
) -> Result<(), Error> {
|
||||
self.put_objects(principal, cal_id, vec![object], overwrite)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use crate::CalendarStore;
|
||||
use async_trait::async_trait;
|
||||
use rustical_ical::CalendarObject;
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
|
||||
pub trait PrefixedCalendarStore: CalendarStore {
|
||||
@@ -88,7 +89,7 @@ impl CalendarStore for CombinedCalendarStore {
|
||||
principal: &str,
|
||||
cal_id: &str,
|
||||
synctoken: i64,
|
||||
) -> Result<(Vec<rustical_ical::CalendarObject>, Vec<String>, i64), crate::Error> {
|
||||
) -> Result<(Vec<(String, CalendarObject)>, Vec<String>, i64), crate::Error> {
|
||||
self.store_for_id(cal_id)
|
||||
.sync_changes(principal, cal_id, synctoken)
|
||||
.await
|
||||
@@ -97,7 +98,7 @@ impl CalendarStore for CombinedCalendarStore {
|
||||
async fn import_calendar(
|
||||
&self,
|
||||
calendar: crate::Calendar,
|
||||
objects: Vec<rustical_ical::CalendarObject>,
|
||||
objects: Vec<(String, CalendarObject)>,
|
||||
merge_existing: bool,
|
||||
) -> Result<(), crate::Error> {
|
||||
self.store_for_id(&calendar.id)
|
||||
@@ -110,7 +111,7 @@ impl CalendarStore for CombinedCalendarStore {
|
||||
principal: &str,
|
||||
cal_id: &str,
|
||||
query: crate::calendar_store::CalendarQuery,
|
||||
) -> Result<Vec<rustical_ical::CalendarObject>, crate::Error> {
|
||||
) -> Result<Vec<(String, CalendarObject)>, crate::Error> {
|
||||
self.store_for_id(cal_id)
|
||||
.calendar_query(principal, cal_id, query)
|
||||
.await
|
||||
@@ -141,7 +142,7 @@ impl CalendarStore for CombinedCalendarStore {
|
||||
&self,
|
||||
principal: &str,
|
||||
cal_id: &str,
|
||||
) -> Result<Vec<rustical_ical::CalendarObject>, crate::Error> {
|
||||
) -> Result<Vec<(String, CalendarObject)>, crate::Error> {
|
||||
self.store_for_id(cal_id)
|
||||
.get_objects(principal, cal_id)
|
||||
.await
|
||||
@@ -151,7 +152,7 @@ impl CalendarStore for CombinedCalendarStore {
|
||||
&self,
|
||||
principal: String,
|
||||
cal_id: String,
|
||||
objects: Vec<rustical_ical::CalendarObject>,
|
||||
objects: Vec<(String, CalendarObject)>,
|
||||
overwrite: bool,
|
||||
) -> Result<(), crate::Error> {
|
||||
self.store_for_id(&cal_id)
|
||||
|
||||
Reference in New Issue
Block a user