//! # Virtual directory controller //! //! @author Pierre Hubert use crate::data::http_request_handler::HttpRequestHandler; use crate::controllers::routes::RequestResult; use crate::helpers::user_helper; use crate::api_data::res_find_user_by_virtual_directory::FindUserByVirtualDirectoryAPIResult; /// Find a user by its virtual directory pub fn find_user(r: &mut HttpRequestHandler) -> RequestResult { let directory = r.post_virtual_directory("subfolder")?; let user = r.ok_or_not_found( user_helper::find_user_by_virtual_directory(&directory), "No user was found with this subfolder!" )?; r.set_response(FindUserByVirtualDirectoryAPIResult::new(user.id)) }