Skip to main content

text_document_direct_access/frame/
dtos.rs

1// Generated by Qleany v1.5.0 from entity_dtos.tera
2
3use common::entities::Frame;
4pub use common::entities::FramePosition;
5use common::types::EntityId;
6use serde::{Deserialize, Serialize};
7use std::convert::From;
8
9#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
10pub struct FrameDto {
11    pub id: EntityId,
12    pub created_at: chrono::DateTime<chrono::Utc>,
13    pub updated_at: chrono::DateTime<chrono::Utc>,
14    pub parent_frame: Option<EntityId>,
15    pub blocks: Vec<EntityId>,
16    pub child_order: Vec<i64>,
17    pub fmt_height: Option<i64>,
18    pub fmt_width: Option<i64>,
19    pub fmt_top_margin: Option<i64>,
20    pub fmt_bottom_margin: Option<i64>,
21    pub fmt_left_margin: Option<i64>,
22    pub fmt_right_margin: Option<i64>,
23    pub fmt_padding: Option<i64>,
24    pub fmt_border: Option<i64>,
25    pub fmt_position: Option<FramePosition>,
26}
27
28impl From<FrameDto> for Frame {
29    fn from(dto: FrameDto) -> Self {
30        Frame {
31            id: dto.id,
32            created_at: dto.created_at,
33            updated_at: dto.updated_at,
34            parent_frame: dto.parent_frame,
35            blocks: dto.blocks,
36            child_order: dto.child_order,
37            fmt_height: dto.fmt_height,
38            fmt_width: dto.fmt_width,
39            fmt_top_margin: dto.fmt_top_margin,
40            fmt_bottom_margin: dto.fmt_bottom_margin,
41            fmt_left_margin: dto.fmt_left_margin,
42            fmt_right_margin: dto.fmt_right_margin,
43            fmt_padding: dto.fmt_padding,
44            fmt_border: dto.fmt_border,
45            fmt_position: dto.fmt_position,
46        }
47    }
48}
49
50impl From<&FrameDto> for Frame {
51    fn from(dto: &FrameDto) -> Self {
52        Frame {
53            id: dto.id,
54            created_at: dto.created_at,
55            updated_at: dto.updated_at,
56            parent_frame: dto.parent_frame,
57            blocks: dto.blocks.clone(),
58            child_order: dto.child_order.clone(),
59            fmt_height: dto.fmt_height,
60            fmt_width: dto.fmt_width,
61            fmt_top_margin: dto.fmt_top_margin,
62            fmt_bottom_margin: dto.fmt_bottom_margin,
63            fmt_left_margin: dto.fmt_left_margin,
64            fmt_right_margin: dto.fmt_right_margin,
65            fmt_padding: dto.fmt_padding,
66            fmt_border: dto.fmt_border,
67            fmt_position: dto.fmt_position.clone(),
68        }
69    }
70}
71
72impl From<Frame> for FrameDto {
73    fn from(entity: Frame) -> Self {
74        FrameDto {
75            id: entity.id,
76            created_at: entity.created_at,
77            updated_at: entity.updated_at,
78            parent_frame: entity.parent_frame,
79            blocks: entity.blocks,
80            child_order: entity.child_order,
81            fmt_height: entity.fmt_height,
82            fmt_width: entity.fmt_width,
83            fmt_top_margin: entity.fmt_top_margin,
84            fmt_bottom_margin: entity.fmt_bottom_margin,
85            fmt_left_margin: entity.fmt_left_margin,
86            fmt_right_margin: entity.fmt_right_margin,
87            fmt_padding: entity.fmt_padding,
88            fmt_border: entity.fmt_border,
89            fmt_position: entity.fmt_position,
90        }
91    }
92}
93
94#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
95pub struct CreateFrameDto {
96    pub created_at: chrono::DateTime<chrono::Utc>,
97    pub updated_at: chrono::DateTime<chrono::Utc>,
98    pub parent_frame: Option<EntityId>,
99    pub blocks: Vec<EntityId>,
100    pub child_order: Vec<i64>,
101    pub fmt_height: Option<i64>,
102    pub fmt_width: Option<i64>,
103    pub fmt_top_margin: Option<i64>,
104    pub fmt_bottom_margin: Option<i64>,
105    pub fmt_left_margin: Option<i64>,
106    pub fmt_right_margin: Option<i64>,
107    pub fmt_padding: Option<i64>,
108    pub fmt_border: Option<i64>,
109    pub fmt_position: Option<FramePosition>,
110}
111
112impl From<CreateFrameDto> for Frame {
113    fn from(dto: CreateFrameDto) -> Self {
114        Frame {
115            id: 0,
116            created_at: dto.created_at,
117            updated_at: dto.updated_at,
118            parent_frame: dto.parent_frame,
119            blocks: dto.blocks,
120            child_order: dto.child_order,
121            fmt_height: dto.fmt_height,
122            fmt_width: dto.fmt_width,
123            fmt_top_margin: dto.fmt_top_margin,
124            fmt_bottom_margin: dto.fmt_bottom_margin,
125            fmt_left_margin: dto.fmt_left_margin,
126            fmt_right_margin: dto.fmt_right_margin,
127            fmt_padding: dto.fmt_padding,
128            fmt_border: dto.fmt_border,
129            fmt_position: dto.fmt_position,
130        }
131    }
132}
133
134impl From<&CreateFrameDto> for Frame {
135    fn from(dto: &CreateFrameDto) -> Self {
136        Frame {
137            id: 0,
138            created_at: dto.created_at,
139            updated_at: dto.updated_at,
140            parent_frame: dto.parent_frame,
141            blocks: dto.blocks.clone(),
142            child_order: dto.child_order.clone(),
143            fmt_height: dto.fmt_height,
144            fmt_width: dto.fmt_width,
145            fmt_top_margin: dto.fmt_top_margin,
146            fmt_bottom_margin: dto.fmt_bottom_margin,
147            fmt_left_margin: dto.fmt_left_margin,
148            fmt_right_margin: dto.fmt_right_margin,
149            fmt_padding: dto.fmt_padding,
150            fmt_border: dto.fmt_border,
151            fmt_position: dto.fmt_position.clone(),
152        }
153    }
154}
155
156impl From<Frame> for CreateFrameDto {
157    fn from(entity: Frame) -> Self {
158        CreateFrameDto {
159            created_at: entity.created_at,
160            updated_at: entity.updated_at,
161            parent_frame: entity.parent_frame,
162            blocks: entity.blocks,
163            child_order: entity.child_order,
164            fmt_height: entity.fmt_height,
165            fmt_width: entity.fmt_width,
166            fmt_top_margin: entity.fmt_top_margin,
167            fmt_bottom_margin: entity.fmt_bottom_margin,
168            fmt_left_margin: entity.fmt_left_margin,
169            fmt_right_margin: entity.fmt_right_margin,
170            fmt_padding: entity.fmt_padding,
171            fmt_border: entity.fmt_border,
172            fmt_position: entity.fmt_position,
173        }
174    }
175}
176
177#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
178pub struct UpdateFrameDto {
179    pub id: EntityId,
180    pub created_at: chrono::DateTime<chrono::Utc>,
181    pub updated_at: chrono::DateTime<chrono::Utc>,
182    pub child_order: Vec<i64>,
183    pub fmt_height: Option<i64>,
184    pub fmt_width: Option<i64>,
185    pub fmt_top_margin: Option<i64>,
186    pub fmt_bottom_margin: Option<i64>,
187    pub fmt_left_margin: Option<i64>,
188    pub fmt_right_margin: Option<i64>,
189    pub fmt_padding: Option<i64>,
190    pub fmt_border: Option<i64>,
191    pub fmt_position: Option<FramePosition>,
192}
193
194impl From<UpdateFrameDto> for Frame {
195    fn from(dto: UpdateFrameDto) -> Self {
196        Frame {
197            id: dto.id,
198            created_at: dto.created_at,
199            updated_at: dto.updated_at,
200            child_order: dto.child_order,
201            fmt_height: dto.fmt_height,
202            fmt_width: dto.fmt_width,
203            fmt_top_margin: dto.fmt_top_margin,
204            fmt_bottom_margin: dto.fmt_bottom_margin,
205            fmt_left_margin: dto.fmt_left_margin,
206            fmt_right_margin: dto.fmt_right_margin,
207            fmt_padding: dto.fmt_padding,
208            fmt_border: dto.fmt_border,
209            fmt_position: dto.fmt_position,
210            parent_frame: Default::default(),
211            blocks: Default::default(),
212        }
213    }
214}
215
216impl From<&UpdateFrameDto> for Frame {
217    fn from(dto: &UpdateFrameDto) -> Self {
218        Frame {
219            id: dto.id,
220            created_at: dto.created_at,
221            updated_at: dto.updated_at,
222            child_order: dto.child_order.clone(),
223            fmt_height: dto.fmt_height,
224            fmt_width: dto.fmt_width,
225            fmt_top_margin: dto.fmt_top_margin,
226            fmt_bottom_margin: dto.fmt_bottom_margin,
227            fmt_left_margin: dto.fmt_left_margin,
228            fmt_right_margin: dto.fmt_right_margin,
229            fmt_padding: dto.fmt_padding,
230            fmt_border: dto.fmt_border,
231            fmt_position: dto.fmt_position.clone(),
232            parent_frame: Default::default(),
233            blocks: Default::default(),
234        }
235    }
236}
237
238impl From<Frame> for UpdateFrameDto {
239    fn from(entity: Frame) -> Self {
240        UpdateFrameDto {
241            id: entity.id,
242            created_at: entity.created_at,
243            updated_at: entity.updated_at,
244            child_order: entity.child_order,
245            fmt_height: entity.fmt_height,
246            fmt_width: entity.fmt_width,
247            fmt_top_margin: entity.fmt_top_margin,
248            fmt_bottom_margin: entity.fmt_bottom_margin,
249            fmt_left_margin: entity.fmt_left_margin,
250            fmt_right_margin: entity.fmt_right_margin,
251            fmt_padding: entity.fmt_padding,
252            fmt_border: entity.fmt_border,
253            fmt_position: entity.fmt_position,
254        }
255    }
256}
257
258impl From<FrameDto> for UpdateFrameDto {
259    fn from(dto: FrameDto) -> Self {
260        UpdateFrameDto {
261            id: dto.id,
262            created_at: dto.created_at,
263            updated_at: dto.updated_at,
264            child_order: dto.child_order,
265            fmt_height: dto.fmt_height,
266            fmt_width: dto.fmt_width,
267            fmt_top_margin: dto.fmt_top_margin,
268            fmt_bottom_margin: dto.fmt_bottom_margin,
269            fmt_left_margin: dto.fmt_left_margin,
270            fmt_right_margin: dto.fmt_right_margin,
271            fmt_padding: dto.fmt_padding,
272            fmt_border: dto.fmt_border,
273            fmt_position: dto.fmt_position,
274        }
275    }
276}
277pub use common::direct_access::frame::FrameRelationshipField;
278
279#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
280pub struct FrameRelationshipDto {
281    pub id: EntityId,
282    pub field: FrameRelationshipField,
283    pub right_ids: Vec<EntityId>,
284}