1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-01-06 10:58:50 +00:00
comunicapiv3/src/controllers/web_app_controller.rs
2021-02-13 16:15:25 +01:00

16 lines
573 B
Rust

//! # Web application controller
//!
//! @author Pierre Hubert
use crate::api_data::user_membership_api::UserMembershipAPI;
use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::http_request_handler::HttpRequestHandler;
use crate::helpers::webapp_helper;
use crate::routes::RequestResult;
/// Get the list of memberships of a given user
pub fn get_memberships(r: &mut HttpRequestHandler) -> RequestResult {
let memberships = webapp_helper::get_user_memberships(r.user_id_ref()?)?;
r.set_response(UserMembershipAPI::for_list(&memberships))
}