1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-22 21:39:21 +00:00

Ready to implement getAdvancedUserInfo route

This commit is contained in:
Pierre HUBERT 2020-05-27 13:28:00 +02:00
parent 250544acbd
commit 3cbf6c2895
2 changed files with 10 additions and 2 deletions

View File

@ -84,5 +84,8 @@ pub fn get_routes() -> Vec<Route> {
Route::post_without_login("/user/getInfoMultiple", Box::new(user_controller::get_multiple)), Route::post_without_login("/user/getInfoMultiple", Box::new(user_controller::get_multiple)),
Route::post_without_login("/user/getInfosMultiple", Box::new(user_controller::get_multiple)), Route::post_without_login("/user/getInfosMultiple", Box::new(user_controller::get_multiple)),
Route::post_without_login("/user/getAdvancedUserInfo", Box::new(user_controller::get_advanced_info)),
Route::post_without_login("/user/getAdvancedUserInfos", Box::new(user_controller::get_advanced_info)),
] ]
} }

View File

@ -34,9 +34,9 @@ pub fn get_multiple(request: &mut HttpRequestHandler) -> RequestResult {
let mut map: HashMap<UserID, APIUserInfo> = HashMap::new(); let mut map: HashMap<UserID, APIUserInfo> = HashMap::new();
for user_id in user_ids { for user_id in user_ids {
let user = request.ok_or_not_found( let user = request.ok_or_not_found(
find_user_by_id(user_id), find_user_by_id(user_id),
"At least one user was not found!" "At least one user was not found!",
)?; )?;
map.insert(user_id, APIUserInfo::new(request.user_id_opt(), &user)?); map.insert(user_id, APIUserInfo::new(request.user_id_opt(), &user)?);
@ -44,3 +44,8 @@ pub fn get_multiple(request: &mut HttpRequestHandler) -> RequestResult {
request.set_response(map) request.set_response(map)
} }
/// Get advanced information about a user
pub fn get_advanced_info(request: &mut HttpRequestHandler) -> RequestResult {
request.success("get user info")
}