mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-07-03 14:43:28 +00:00
Can access admin logs from the API
This commit is contained in:
26
src/api_data/admin/admin_log_api.rs
Normal file
26
src/api_data/admin/admin_log_api.rs
Normal file
@ -0,0 +1,26 @@
|
||||
//! # Admin log api entry
|
||||
//!
|
||||
//! @author Pierre Hubert
|
||||
|
||||
use crate::data::admin_action_log::{AdminActionLog, AdminAction};
|
||||
|
||||
#[derive(serde::Serialize)]
|
||||
pub struct AdminLogAPI {
|
||||
id: u64,
|
||||
admin_id: u64,
|
||||
ip: String,
|
||||
time: u64,
|
||||
action: AdminAction
|
||||
}
|
||||
|
||||
impl AdminLogAPI {
|
||||
pub fn new(log: &AdminActionLog) -> Self{
|
||||
Self {
|
||||
id: log.id,
|
||||
admin_id: log.admin_id.id(),
|
||||
ip: log.ip.to_string(),
|
||||
time: log.time,
|
||||
action: log.action.clone()
|
||||
}
|
||||
}
|
||||
}
|
@ -9,4 +9,5 @@ pub mod admin_info_api;
|
||||
pub mod admin_keys_api;
|
||||
pub mod admin_res_create_reset_token;
|
||||
pub mod admin_role_api;
|
||||
pub mod admin_res_create_account;
|
||||
pub mod admin_res_create_account;
|
||||
pub mod admin_log_api;
|
Reference in New Issue
Block a user