postmasterlib/dto/
test_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
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 TestLog {
    pub from: UserMinimal,
    pub to: UserMinimal,
    pub test_name: String,
    pub approved: String,
    pub comment: String,
    pub questions: Vec<Question>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Question {
    pub name: String,
    pub approved: String,
    pub comment: String,
}

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

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

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