adding webdav features

This commit is contained in:
DioCrafts
2025-04-04 21:31:41 +02:00
parent e3256bb3b5
commit ba3ef2a530
21 changed files with 3358 additions and 960 deletions
+20
View File
@@ -482,6 +482,14 @@ impl Default for AppState {
async fn get_file_path(&self, _id: &str) -> Result<crate::domain::services::path_service::StoragePath, crate::common::errors::DomainError> {
Ok(crate::domain::services::path_service::StoragePath::from_string("/"))
}
async fn get_parent_folder_id(&self, _path: &str) -> Result<String, crate::common::errors::DomainError> {
Ok("root".to_string())
}
async fn update_file_content(&self, _file_id: &str, _content: Vec<u8>) -> Result<(), crate::common::errors::DomainError> {
Ok(())
}
}
struct DummyFolderStoragePort;
@@ -618,6 +626,18 @@ impl Default for AppState {
Ok(crate::application::dtos::file_dto::FileDto::default())
}
async fn get_file_by_path(&self, _path: &str) -> Result<crate::application::dtos::file_dto::FileDto, crate::common::errors::DomainError> {
Ok(crate::application::dtos::file_dto::FileDto::default())
}
async fn create_file(&self, _parent_path: &str, _filename: &str, _content: &[u8], _content_type: &str) -> Result<crate::application::dtos::file_dto::FileDto, crate::common::errors::DomainError> {
Ok(crate::application::dtos::file_dto::FileDto::default())
}
async fn update_file(&self, _path: &str, _content: &[u8]) -> Result<(), crate::common::errors::DomainError> {
Ok(())
}
async fn list_files(&self, _folder_id: Option<&str>) -> Result<Vec<crate::application::dtos::file_dto::FileDto>, crate::common::errors::DomainError> {
Ok(Vec::new())
}
+12
View File
@@ -285,6 +285,18 @@ impl AppError {
pub fn internal_error(message: impl Into<String>) -> Self {
Self::new(axum::http::StatusCode::INTERNAL_SERVER_ERROR, message, "InternalError")
}
pub fn method_not_allowed(message: impl Into<String>) -> Self {
Self::new(axum::http::StatusCode::METHOD_NOT_ALLOWED, message, "MethodNotAllowed")
}
pub fn conflict(message: impl Into<String>) -> Self {
Self::new(axum::http::StatusCode::CONFLICT, message, "Conflict")
}
pub fn unsupported_media_type(message: impl Into<String>) -> Self {
Self::new(axum::http::StatusCode::UNSUPPORTED_MEDIA_TYPE, message, "UnsupportedMediaType")
}
}
impl From<DomainError> for AppError {