postmasterlib/dto/
medication_log.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use serde::{Deserialize, Serialize};

use crate::dto::user_minimal::UserMinimal;
use crate::dto::GenericLetterDto;
use crate::enums::templates::Templates;

#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct MedicationLog {
    pub from: UserMinimal,
    pub to: UserMinimal,
    pub org_name : String,
    pub sickbay_name : String,
    pub medication_expire: Vec<MedicationExpire>,
    pub medication_stock: Vec<MedicationStock>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct MedicationExpire {
    pub number: i32,
    pub item: String,
    pub expire: String,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct MedicationStock{
    pub number: i32,
    pub item: String,
    pub stock: String,
    pub limit: String,
}

impl GenericLetterDto for MedicationLog {
    fn get_template(&self) -> Templates {
        Templates::MedicationLog
    }

    fn get_to_user(&self) -> UserMinimal {
        self.to.clone()
    }

    fn get_from_user(&self) -> UserMinimal {
        self.from.clone()
    }
}