Skip to main content

text_document_direct_access/frame/
dtos.rs

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