chemlib/dto/
reaction_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
28
29
30
31
use serde::{Deserialize, Serialize};
use uuid::Uuid;
use crate::dto::compound_response::CompoundResponse;
use crate::jsonb::effect::Effect;
use crate::jsonb::outcome::Outcome;
use crate::jsonb::condition::Condition;


#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ReactionResponse {
    pub id: Uuid,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ver: Option<i32>,
    pub reagents: Vec<Uuid>,
    pub conditions: Vec<Condition>,
    pub outcome: Vec<Outcome>,
    pub outcome_compounds:Option<Vec<CompoundResponse>>, //доп поле для клиента
    pub effects: Vec<Effect>,
}

// pub fn from_reaction_list(reactions: Vec<Reaction>) -> Vec<ReactionResponse> {
// 	let mut res: Vec<ReactionResponse> = vec![];
// 	if reactions.is_empty() {
// 		return res;
// 	}
// 	for reaction in reactions.iter() {
// 		res.push(ReactionResponse::from_reaction(reaction.clone()));
// 	}
// 	res
// }