wellbeinglib/jsonb/
restriction.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use chrono::NaiveDateTime;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
use chrono::naive::serde::ts_milliseconds;

use crate::enums::restriction_type::RestrictionType;

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct Restriction {
    pub id: Uuid,
    pub restriction_type: RestrictionType,
    pub name: String,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub user_id: Option<Uuid>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub commnent: Option<String>,
    #[serde(with = "ts_milliseconds")]
    pub from : NaiveDateTime,
    #[serde(with = "ts_milliseconds")]
    pub to : NaiveDateTime,
}