mirror of
				https://gitlab.com/comunic/comunicapiv3
				synced 2025-11-04 01:24:04 +00:00 
			
		
		
		
	Start to return user information
This commit is contained in:
		@@ -9,4 +9,5 @@
 | 
			
		||||
 | 
			
		||||
pub mod http_error;
 | 
			
		||||
pub mod login_success;
 | 
			
		||||
pub mod current_user_id;
 | 
			
		||||
pub mod current_user_id;
 | 
			
		||||
pub mod user_info;
 | 
			
		||||
							
								
								
									
										24
									
								
								src/api_data/user_info.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								src/api_data/user_info.rs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
			
		||||
//! API representation of user information
 | 
			
		||||
//!
 | 
			
		||||
//! @author Pierre Hubert
 | 
			
		||||
use serde::Serialize;
 | 
			
		||||
 | 
			
		||||
use crate::data::user::User;
 | 
			
		||||
 | 
			
		||||
#[derive(Serialize)]
 | 
			
		||||
#[allow(non_snake_case)]
 | 
			
		||||
pub struct APIUserInfo {
 | 
			
		||||
    userID: i64,
 | 
			
		||||
    firstName: String,
 | 
			
		||||
    lastName: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl APIUserInfo {
 | 
			
		||||
    pub fn new(info: User) -> APIUserInfo {
 | 
			
		||||
        APIUserInfo {
 | 
			
		||||
            userID: info.id,
 | 
			
		||||
            firstName: info.first_name,
 | 
			
		||||
            lastName: info.last_name,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user