1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-01-07 19:32:34 +00:00
comunicapiv3/src/controllers/web_app_controller.rs

16 lines
573 B
Rust
Raw Normal View History

2020-07-12 12:32:18 +00:00
//! # Web application controller
//!
//! @author Pierre Hubert
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;
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 {
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
}