Add namespaces to propnames

This commit is contained in:
Lennart
2025-01-18 18:56:37 +01:00
parent 461c67a72b
commit ea9f5a711d
12 changed files with 118 additions and 76 deletions

View File

@@ -7,9 +7,9 @@ use rustical_dav::resource::{NamedRoute, Resource, ResourceService};
use rustical_dav::xml::{HrefElement, Resourcetype, ResourcetypeInner};
use rustical_store::auth::User;
use rustical_store::AddressbookStore;
use rustical_xml::{XmlDeserialize, XmlSerialize};
use rustical_xml::{EnumVariants, XmlDeserialize, XmlSerialize};
use std::sync::Arc;
use strum::{EnumDiscriminants, EnumString, IntoStaticStr, VariantNames};
use strum::{EnumDiscriminants, EnumString, IntoStaticStr};
pub struct PrincipalResourceService<A: AddressbookStore> {
addr_store: Arc<A>,
@@ -26,10 +26,10 @@ pub struct PrincipalResource {
principal: String,
}
#[derive(XmlDeserialize, XmlSerialize, PartialEq, EnumDiscriminants, Clone)]
#[derive(XmlDeserialize, XmlSerialize, PartialEq, EnumDiscriminants, Clone, EnumVariants)]
#[strum_discriminants(
name(PrincipalPropName),
derive(EnumString, VariantNames, IntoStaticStr),
derive(EnumString, IntoStaticStr),
strum(serialize_all = "kebab-case")
)]
pub enum PrincipalProp {
@@ -69,8 +69,8 @@ impl Resource for PrincipalResource {
fn get_resourcetype(&self) -> Resourcetype {
Resourcetype(&[
ResourcetypeInner(rustical_dav::namespace::NS_DAV, "collection"),
ResourcetypeInner(rustical_dav::namespace::NS_DAV, "principal"),
ResourcetypeInner(Some(rustical_dav::namespace::NS_DAV), "collection"),
ResourcetypeInner(Some(rustical_dav::namespace::NS_DAV), "principal"),
])
}