mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 09:22:26 +00:00
prop: implement InvalidProperty with Default
This commit is contained in:
@@ -2,11 +2,11 @@ use super::methods::{get_event, put_event};
|
||||
use crate::{principal::PrincipalResource, Error};
|
||||
use actix_web::{dev::ResourceMap, web::Data, HttpRequest};
|
||||
use async_trait::async_trait;
|
||||
use derive_more::derive::{From, Into, TryInto};
|
||||
use derive_more::derive::{From, Into};
|
||||
use rustical_dav::{
|
||||
extensions::CommonPropertiesProp,
|
||||
privileges::UserPrivilegeSet,
|
||||
resource::{InvalidProperty, Resource, ResourceService},
|
||||
resource::{Resource, ResourceService},
|
||||
};
|
||||
use rustical_store::{auth::User, CalendarObject, CalendarStore};
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -29,7 +29,7 @@ pub enum CalendarObjectPropName {
|
||||
Getcontenttype,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, From, TryInto)]
|
||||
#[derive(Default, Deserialize, Serialize, From, PartialEq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub enum CalendarObjectProp {
|
||||
// WebDAV (RFC 2518)
|
||||
@@ -42,19 +42,13 @@ pub enum CalendarObjectProp {
|
||||
|
||||
#[serde(skip_deserializing, untagged)]
|
||||
#[from]
|
||||
#[try_into]
|
||||
ExtCommonProperties(CommonPropertiesProp<Resourcetype>),
|
||||
|
||||
#[serde(untagged)]
|
||||
#[default]
|
||||
Invalid,
|
||||
}
|
||||
|
||||
impl InvalidProperty for CalendarObjectProp {
|
||||
fn invalid_property(&self) -> bool {
|
||||
matches!(self, Self::Invalid)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, From, Into)]
|
||||
pub struct CalendarObjectResource {
|
||||
pub object: CalendarObject,
|
||||
@@ -62,7 +56,7 @@ pub struct CalendarObjectResource {
|
||||
}
|
||||
|
||||
// TODO: set correct resourcetype
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, Default)]
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, Default, PartialEq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub struct Resourcetype {
|
||||
collection: (),
|
||||
|
||||
Reference in New Issue
Block a user