2020-06-23 13:06:26 +00:00
|
|
|
//! # Search controller
|
|
|
|
//!
|
|
|
|
//! @author Pierre Hubert
|
|
|
|
|
|
|
|
use crate::controllers::routes::RequestResult;
|
|
|
|
use crate::data::http_request_handler::HttpRequestHandler;
|
|
|
|
use crate::helpers::user_helper;
|
|
|
|
|
|
|
|
/// Search for user
|
|
|
|
pub fn search_user(r: &mut HttpRequestHandler) -> RequestResult {
|
|
|
|
let query = r.post_string_opt("query", 1, true)?;
|
|
|
|
let limit = r.post_u64_opt("searchLimit", 5)?;
|
|
|
|
|
|
|
|
let list = user_helper::search_user(&query, limit)?;
|
|
|
|
|
|
|
|
r.set_response(list)
|
2020-06-23 13:14:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Perform a global search
|
|
|
|
pub fn search_global(r: &mut HttpRequestHandler) -> RequestResult {
|
|
|
|
r.success("implement me")
|
2020-06-23 13:06:26 +00:00
|
|
|
}
|