mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 16:32:29 +00:00
Refactoring that will hopefully make life easier
This commit is contained in:
@@ -4,13 +4,12 @@ use crate::namespace::Namespace;
|
||||
use crate::resource::InvalidProperty;
|
||||
use crate::resource::Resource;
|
||||
use crate::resource::ResourceService;
|
||||
use crate::resource::{PropstatElement, PropstatResponseElement, PropstatType};
|
||||
use crate::xml::multistatus::{PropstatElement, PropstatWrapper, ResponseElement};
|
||||
use crate::xml::MultistatusElement;
|
||||
use crate::xml::TagList;
|
||||
use crate::xml::TagName;
|
||||
use crate::Error;
|
||||
use actix_web::http::StatusCode;
|
||||
use actix_web::Responder;
|
||||
use actix_web::{web::Path, HttpRequest};
|
||||
use log::debug;
|
||||
use rustical_auth::{AuthInfoExtractor, CheckAuthentication};
|
||||
@@ -55,7 +54,7 @@ pub async fn route_proppatch<A: CheckAuthentication, R: ResourceService + ?Sized
|
||||
body: String,
|
||||
req: HttpRequest,
|
||||
auth: AuthInfoExtractor<A>,
|
||||
) -> Result<impl Responder, R::Error> {
|
||||
) -> Result<MultistatusElement<PropstatWrapper<String>, PropstatWrapper<String>>, R::Error> {
|
||||
let auth_info = auth.inner;
|
||||
let path_components = path.into_inner();
|
||||
let href = req.path().to_owned();
|
||||
@@ -138,25 +137,25 @@ pub async fn route_proppatch<A: CheckAuthentication, R: ResourceService + ?Sized
|
||||
}
|
||||
|
||||
Ok(MultistatusElement {
|
||||
responses: vec![PropstatResponseElement {
|
||||
responses: vec![ResponseElement {
|
||||
href,
|
||||
propstat: vec![
|
||||
PropstatType::Normal(PropstatElement {
|
||||
PropstatWrapper::TagList(PropstatElement {
|
||||
prop: TagList::from(props_ok),
|
||||
status: format!("HTTP/1.1 {}", StatusCode::OK),
|
||||
}),
|
||||
PropstatType::NotFound(PropstatElement {
|
||||
PropstatWrapper::TagList(PropstatElement {
|
||||
prop: TagList::from(props_not_found),
|
||||
status: format!("HTTP/1.1 {}", StatusCode::NOT_FOUND),
|
||||
}),
|
||||
PropstatType::Conflict(PropstatElement {
|
||||
PropstatWrapper::TagList(PropstatElement {
|
||||
prop: TagList::from(props_conflict),
|
||||
status: format!("HTTP/1.1 {}", StatusCode::CONFLICT),
|
||||
}),
|
||||
],
|
||||
}],
|
||||
// Dummy just for typing
|
||||
member_responses: Vec::<String>::new(),
|
||||
member_responses: vec![],
|
||||
ns_dav: Namespace::Dav.as_str(),
|
||||
ns_caldav: Namespace::CalDAV.as_str(),
|
||||
ns_ical: Namespace::ICal.as_str(),
|
||||
|
||||
Reference in New Issue
Block a user