1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-12-01 17:56:28 +00:00
comunicapiv3/src/api_data/data_conservation_settings_api.rs

29 lines
925 B
Rust
Raw Normal View History

2021-02-15 16:38:25 +00:00
//! # Data conservation settings API object
//!
//! @author Pierre Hubert
use serde::Serialize;
use crate::data::user::User;
#[derive(Serialize)]
pub struct DataConservationSettingsAPI {
inactive_account_lifetime: Option<u64>,
notification_lifetime: Option<u64>,
comments_lifetime: Option<u64>,
posts_lifetime: Option<u64>,
conversation_messages_lifetime: Option<u64>,
likes_lifetime: Option<u64>,
}
impl DataConservationSettingsAPI {
pub fn new(user: &User) -> Self {
Self {
inactive_account_lifetime: user.delete_account_after.clone(),
notification_lifetime: user.delete_notifications_after,
comments_lifetime: user.delete_comments_after,
posts_lifetime: user.delete_posts_after,
conversation_messages_lifetime: user.delete_conversation_messages_after,
likes_lifetime: user.delete_likes_after,
}
}
}