chemlib/dto/
compound_response.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
use crate::jsonb::formula::Formula;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
use crate::enums::agregate_state::AggregateState;

#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct CompoundResponse {
    pub id: Uuid,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ver: Option<i32>,
    pub formula: Formula,
    pub aggregate_state: AggregateState,
    pub lang: String,
    pub label: String,
}

// pub fn from_compound_list(compounds: Vec<Compound>) -> Vec<CompoundResponse> {
// 	let mut res: Vec<CompoundResponse> = vec![];
// 	if compounds.is_empty() {
// 		return res;
// 	}
// 	for compound in compounds.iter() {
// 		res.push(CompoundResponse::from_compound(compound.clone()));
// 	}
// 	res
// }