mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-28 06:09:13 +00:00
caldav: Outsource text-match to rustical_dav
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -3390,6 +3390,7 @@ dependencies = [
|
|||||||
"futures-util",
|
"futures-util",
|
||||||
"headers",
|
"headers",
|
||||||
"http",
|
"http",
|
||||||
|
"ical",
|
||||||
"itertools 0.14.0",
|
"itertools 0.14.0",
|
||||||
"log",
|
"log",
|
||||||
"matchit 0.9.0",
|
"matchit 0.9.0",
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ opentelemetry = [
|
|||||||
debug = 0
|
debug = 0
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
rustical_dav = { path = "./crates/dav/" }
|
rustical_dav = { path = "./crates/dav/", features = ["ical"] }
|
||||||
rustical_dav_push = { path = "./crates/dav_push/" }
|
rustical_dav_push = { path = "./crates/dav_push/" }
|
||||||
rustical_store = { path = "./crates/store/" }
|
rustical_store = { path = "./crates/store/" }
|
||||||
rustical_store_sqlite = { path = "./crates/store_sqlite/" }
|
rustical_store_sqlite = { path = "./crates/store_sqlite/" }
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ base64.workspace = true
|
|||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
tokio.workspace = true
|
tokio.workspace = true
|
||||||
url.workspace = true
|
url.workspace = true
|
||||||
rustical_dav.workspace = true
|
rustical_dav = { workspace = true, features = ["ical"] }
|
||||||
rustical_store.workspace = true
|
rustical_store.workspace = true
|
||||||
chrono.workspace = true
|
chrono.workspace = true
|
||||||
chrono-tz.workspace = true
|
chrono-tz.workspace = true
|
||||||
|
|||||||
@@ -137,13 +137,11 @@ impl CompFilterable for CalendarObjectComponent {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use chrono::{TimeZone, Utc};
|
use chrono::{TimeZone, Utc};
|
||||||
|
use rustical_dav::xml::{NegateCondition, TextCollation, TextMatchElement};
|
||||||
use rustical_ical::{CalendarObject, UtcDateTime};
|
use rustical_ical::{CalendarObject, UtcDateTime};
|
||||||
|
|
||||||
use crate::calendar::methods::report::calendar_query::{
|
use crate::calendar::methods::report::calendar_query::{
|
||||||
CompFilterable, TextMatchElement, TimeRangeElement,
|
CompFilterElement, CompFilterable, PropFilterElement, TimeRangeElement,
|
||||||
comp_filter::CompFilterElement,
|
|
||||||
prop_filter::PropFilterElement,
|
|
||||||
text_match::{NegateCondition, TextCollation},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const ICS: &str = r"BEGIN:VCALENDAR
|
const ICS: &str = r"BEGIN:VCALENDAR
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
use crate::{
|
use super::comp_filter::{CompFilterElement, CompFilterable};
|
||||||
calendar::methods::report::calendar_query::{
|
use crate::calendar_object::CalendarObjectPropWrapperName;
|
||||||
TextMatchElement,
|
use rustical_dav::xml::{PropfindType, TextMatchElement};
|
||||||
comp_filter::{CompFilterElement, CompFilterable},
|
|
||||||
},
|
|
||||||
calendar_object::CalendarObjectPropWrapperName,
|
|
||||||
};
|
|
||||||
use rustical_dav::xml::PropfindType;
|
|
||||||
use rustical_ical::{CalendarObject, UtcDateTime};
|
use rustical_ical::{CalendarObject, UtcDateTime};
|
||||||
use rustical_store::calendar_store::CalendarQuery;
|
use rustical_store::calendar_store::CalendarQuery;
|
||||||
use rustical_xml::XmlDeserialize;
|
use rustical_xml::XmlDeserialize;
|
||||||
|
|||||||
@@ -5,14 +5,11 @@ use rustical_store::CalendarStore;
|
|||||||
mod comp_filter;
|
mod comp_filter;
|
||||||
mod elements;
|
mod elements;
|
||||||
mod prop_filter;
|
mod prop_filter;
|
||||||
pub mod text_match;
|
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
pub use comp_filter::{CompFilterElement, CompFilterable};
|
pub use comp_filter::{CompFilterElement, CompFilterable};
|
||||||
pub use elements::*;
|
pub use elements::*;
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
pub use prop_filter::{PropFilterElement, PropFilterable};
|
pub use prop_filter::{PropFilterElement, PropFilterable};
|
||||||
#[allow(unused_imports)]
|
|
||||||
pub use text_match::TextMatchElement;
|
|
||||||
|
|
||||||
pub async fn get_objects_calendar_query<C: CalendarStore>(
|
pub async fn get_objects_calendar_query<C: CalendarStore>(
|
||||||
cal_query: &CalendarQueryRequest,
|
cal_query: &CalendarQueryRequest,
|
||||||
@@ -31,21 +28,16 @@ pub async fn get_objects_calendar_query<C: CalendarStore>(
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use rustical_dav::xml::PropElement;
|
use super::{
|
||||||
use rustical_xml::XmlDocument;
|
CalendarQueryRequest, FilterElement, ParamFilterElement, comp_filter::CompFilterElement,
|
||||||
|
prop_filter::PropFilterElement,
|
||||||
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
calendar::methods::report::{
|
calendar::methods::report::ReportRequest,
|
||||||
ReportRequest,
|
|
||||||
calendar_query::{
|
|
||||||
CalendarQueryRequest, FilterElement, ParamFilterElement, TextMatchElement,
|
|
||||||
comp_filter::CompFilterElement,
|
|
||||||
prop_filter::PropFilterElement,
|
|
||||||
text_match::{NegateCondition, TextCollation},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
calendar_object::{CalendarData, CalendarObjectPropName, CalendarObjectPropWrapperName},
|
calendar_object::{CalendarData, CalendarObjectPropName, CalendarObjectPropWrapperName},
|
||||||
};
|
};
|
||||||
|
use rustical_dav::xml::{NegateCondition, PropElement, TextCollation, TextMatchElement};
|
||||||
|
use rustical_xml::XmlDocument;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn calendar_query_7_8_7() {
|
fn calendar_query_7_8_7() {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
use std::collections::HashMap;
|
use super::{ParamFilterElement, TimeRangeElement};
|
||||||
|
|
||||||
use ical::{
|
use ical::{
|
||||||
generator::{IcalCalendar, IcalEvent},
|
generator::{IcalCalendar, IcalEvent},
|
||||||
parser::{
|
parser::{
|
||||||
@@ -8,12 +7,10 @@ use ical::{
|
|||||||
},
|
},
|
||||||
property::Property,
|
property::Property,
|
||||||
};
|
};
|
||||||
|
use rustical_dav::xml::TextMatchElement;
|
||||||
use rustical_ical::{CalDateTime, CalendarObject, CalendarObjectComponent, UtcDateTime};
|
use rustical_ical::{CalDateTime, CalendarObject, CalendarObjectComponent, UtcDateTime};
|
||||||
use rustical_xml::XmlDeserialize;
|
use rustical_xml::XmlDeserialize;
|
||||||
|
use std::collections::HashMap;
|
||||||
use crate::calendar::methods::report::calendar_query::{
|
|
||||||
ParamFilterElement, TextMatchElement, TimeRangeElement,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(XmlDeserialize, Clone, Debug, PartialEq, Eq)]
|
#[derive(XmlDeserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
use derive_more::derive::{From, Into};
|
use derive_more::derive::{From, Into};
|
||||||
|
use rustical_dav::xml::TextCollation;
|
||||||
use rustical_ical::CalendarObjectType;
|
use rustical_ical::CalendarObjectType;
|
||||||
use rustical_xml::{XmlDeserialize, XmlSerialize};
|
use rustical_xml::{XmlDeserialize, XmlSerialize};
|
||||||
use strum_macros::VariantArray;
|
use strum_macros::VariantArray;
|
||||||
|
|
||||||
use crate::calendar::methods::report::calendar_query::text_match::TextCollation;
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, XmlSerialize, XmlDeserialize, PartialEq, Eq, From, Into)]
|
#[derive(Debug, Clone, XmlSerialize, XmlDeserialize, PartialEq, Eq, From, Into)]
|
||||||
pub struct SupportedCalendarComponent {
|
pub struct SupportedCalendarComponent {
|
||||||
#[xml(ty = "attr")]
|
#[xml(ty = "attr")]
|
||||||
|
|||||||
@@ -28,3 +28,7 @@ headers.workspace = true
|
|||||||
strum.workspace = true
|
strum.workspace = true
|
||||||
matchit.workspace = true
|
matchit.workspace = true
|
||||||
matchit-serde.workspace = true
|
matchit-serde.workspace = true
|
||||||
|
ical = { workspace = true, optional = true }
|
||||||
|
|
||||||
|
[features]
|
||||||
|
ical = ["dep:ical"]
|
||||||
|
|||||||
@@ -15,3 +15,7 @@ mod report_set;
|
|||||||
pub use report_set::SupportedReportSet;
|
pub use report_set::SupportedReportSet;
|
||||||
mod group;
|
mod group;
|
||||||
pub use group::*;
|
pub use group::*;
|
||||||
|
#[cfg(feature = "ical")]
|
||||||
|
mod text_match;
|
||||||
|
#[cfg(feature = "ical")]
|
||||||
|
pub use text_match::*;
|
||||||
|
|||||||
@@ -64,9 +64,9 @@ pub struct TextMatchElement {
|
|||||||
#[xml(ty = "attr", default = "Default::default")]
|
#[xml(ty = "attr", default = "Default::default")]
|
||||||
pub collation: TextCollation,
|
pub collation: TextCollation,
|
||||||
#[xml(ty = "attr", default = "Default::default")]
|
#[xml(ty = "attr", default = "Default::default")]
|
||||||
pub(crate) negate_condition: NegateCondition,
|
pub negate_condition: NegateCondition,
|
||||||
#[xml(ty = "text")]
|
#[xml(ty = "text")]
|
||||||
pub(crate) needle: String,
|
pub needle: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TextMatchElement {
|
impl TextMatchElement {
|
||||||
@@ -90,7 +90,7 @@ impl TextMatchElement {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::calendar::methods::report::calendar_query::text_match::TextCollation;
|
use super::TextCollation;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_collation() {
|
fn test_collation() {
|
||||||
Reference in New Issue
Block a user