chemlib/jsonb/
composition_content.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
use crate::dto::compound_response::CompoundResponse;
use serde::{Deserialize, Serialize};
use uuid::Uuid;

#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Chemical {
    pub chemical: Uuid, // Compound id
    #[serde(skip_serializing_if = "Option::is_none")]
    pub compound: Option<CompoundResponse>, //формируется только для ответа
    pub flask: String,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Shelf {
    pub chemicals: Vec<Chemical>,
    pub index: i32,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Locker {
    pub id: Uuid,
    pub shelves: Vec<Shelf>,
    #[serde(rename(serialize = "type", deserialize = "type"))]
    pub l_type: String,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct CompositionContent {
    // pub id: Uuid,
    pub lockers: Vec<Locker>,
    // #[serde(skip_serializing_if = "Option::is_none")]
    // pub rstatus:Option<String>,
    // #[serde(skip_serializing_if = "Option::is_none")]
    // pub title:Option<String>,
    // #[serde(skip_serializing_if = "Option::is_none")]
    // pub ver:Option<i32>
}