1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-21 00:45:18 +00:00

Can get account image settings

This commit is contained in:
2021-01-19 18:14:17 +01:00
parent 6c7fa3afa5
commit 364a98634f
5 changed files with 50 additions and 1 deletions

View File

@ -102,6 +102,7 @@ pub fn get_routes() -> Vec<Route> {
Route::post("/settings/set_security", Box::new(settings_controller::set_security)),
Route::post("/settings/check_password", Box::new(settings_controller::check_password)),
Route::post("/settings/update_password", Box::new(settings_controller::update_password)),
Route::post("/settings/get_account_image", Box::new(settings_controller::get_account_image_settings)),
// Friends controller

View File

@ -14,6 +14,7 @@ use crate::data::security_settings::{SecurityQuestion, SecuritySettings};
use crate::data::user::UserPageStatus;
use crate::helpers::{account_helper, user_helper};
use crate::helpers::virtual_directory_helper::VirtualDirType;
use crate::api_data::account_image_settings_api::AccountImageSettingsAPI;
/// Get the general settings of the user
pub fn get_general(r: &mut HttpRequestHandler) -> RequestResult {
@ -134,4 +135,11 @@ pub fn update_password(r: &mut HttpRequestHandler) -> RequestResult {
account_helper::change_password(r.user_id_ref()?, &new_password)?;
r.success("Password updated !")
}
/// Get account image settings
pub fn get_account_image_settings(r: &mut HttpRequestHandler) -> RequestResult {
let user = user_helper::find_user_by_id(r.user_id_ref()?)?;
r.set_response(AccountImageSettingsAPI::new(&user))
}