2020-07-12 12:32:18 +00:00
|
|
|
//! # Web application controller
|
|
|
|
//!
|
|
|
|
//! @author Pierre Hubert
|
|
|
|
|
2020-07-13 09:17:35 +00:00
|
|
|
use crate::api_data::user_membership_api::UserMembershipAPI;
|
2021-02-05 08:11:30 +00:00
|
|
|
use crate::data::base_request_handler::BaseRequestHandler;
|
2020-07-12 12:32:18 +00:00
|
|
|
use crate::data::http_request_handler::HttpRequestHandler;
|
2020-07-13 09:17:35 +00:00
|
|
|
use crate::helpers::webapp_helper;
|
2021-02-13 15:15:25 +00:00
|
|
|
use crate::routes::RequestResult;
|
2020-07-12 12:32:18 +00:00
|
|
|
|
|
|
|
/// Get the list of memberships of a given user
|
|
|
|
pub fn get_memberships(r: &mut HttpRequestHandler) -> RequestResult {
|
2020-07-13 09:17:35 +00:00
|
|
|
let memberships = webapp_helper::get_user_memberships(r.user_id_ref()?)?;
|
|
|
|
|
|
|
|
r.set_response(UserMembershipAPI::for_list(&memberships))
|
2020-07-12 12:32:18 +00:00
|
|
|
}
|