1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-01-08 11:42:35 +00:00
comunicapiv3/src/controllers/search_controller.rs
2020-06-23 15:06:26 +02:00

17 lines
471 B
Rust

//! # 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)
}