Skip to main content

text_document_direct_access/block/
dtos.rs

1// Generated by Qleany v1.5.0 from entity_dtos.tera
2
3pub use common::entities::Alignment;
4use common::entities::Block;
5pub use common::entities::MarkerType;
6pub use common::entities::TextDirection;
7use common::types::EntityId;
8use serde::{Deserialize, Serialize};
9use std::convert::From;
10
11#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
12pub struct BlockDto {
13    pub id: EntityId,
14    pub created_at: chrono::DateTime<chrono::Utc>,
15    pub updated_at: chrono::DateTime<chrono::Utc>,
16    pub elements: Vec<EntityId>,
17    pub list: Option<EntityId>,
18    pub text_length: i64,
19    pub document_position: i64,
20    pub plain_text: String,
21    pub fmt_alignment: Option<Alignment>,
22    pub fmt_top_margin: Option<i64>,
23    pub fmt_bottom_margin: Option<i64>,
24    pub fmt_left_margin: Option<i64>,
25    pub fmt_right_margin: Option<i64>,
26    pub fmt_heading_level: Option<i64>,
27    pub fmt_indent: Option<i64>,
28    pub fmt_text_indent: Option<i64>,
29    pub fmt_marker: Option<MarkerType>,
30    pub fmt_tab_positions: Vec<i64>,
31    pub fmt_line_height: Option<i64>,
32    pub fmt_non_breakable_lines: Option<bool>,
33    pub fmt_direction: Option<TextDirection>,
34    pub fmt_background_color: Option<String>,
35}
36
37impl From<BlockDto> for Block {
38    fn from(dto: BlockDto) -> Self {
39        Block {
40            id: dto.id,
41            created_at: dto.created_at,
42            updated_at: dto.updated_at,
43            elements: dto.elements,
44            list: dto.list,
45            text_length: dto.text_length,
46            document_position: dto.document_position,
47            plain_text: dto.plain_text,
48            fmt_alignment: dto.fmt_alignment,
49            fmt_top_margin: dto.fmt_top_margin,
50            fmt_bottom_margin: dto.fmt_bottom_margin,
51            fmt_left_margin: dto.fmt_left_margin,
52            fmt_right_margin: dto.fmt_right_margin,
53            fmt_heading_level: dto.fmt_heading_level,
54            fmt_indent: dto.fmt_indent,
55            fmt_text_indent: dto.fmt_text_indent,
56            fmt_marker: dto.fmt_marker,
57            fmt_tab_positions: dto.fmt_tab_positions,
58            fmt_line_height: dto.fmt_line_height,
59            fmt_non_breakable_lines: dto.fmt_non_breakable_lines,
60            fmt_direction: dto.fmt_direction,
61            fmt_background_color: dto.fmt_background_color,
62        }
63    }
64}
65
66impl From<&BlockDto> for Block {
67    fn from(dto: &BlockDto) -> Self {
68        Block {
69            id: dto.id,
70            created_at: dto.created_at,
71            updated_at: dto.updated_at,
72            elements: dto.elements.clone(),
73            list: dto.list,
74            text_length: dto.text_length,
75            document_position: dto.document_position,
76            plain_text: dto.plain_text.clone(),
77            fmt_alignment: dto.fmt_alignment.clone(),
78            fmt_top_margin: dto.fmt_top_margin,
79            fmt_bottom_margin: dto.fmt_bottom_margin,
80            fmt_left_margin: dto.fmt_left_margin,
81            fmt_right_margin: dto.fmt_right_margin,
82            fmt_heading_level: dto.fmt_heading_level,
83            fmt_indent: dto.fmt_indent,
84            fmt_text_indent: dto.fmt_text_indent,
85            fmt_marker: dto.fmt_marker.clone(),
86            fmt_tab_positions: dto.fmt_tab_positions.clone(),
87            fmt_line_height: dto.fmt_line_height,
88            fmt_non_breakable_lines: dto.fmt_non_breakable_lines,
89            fmt_direction: dto.fmt_direction.clone(),
90            fmt_background_color: dto.fmt_background_color.clone(),
91        }
92    }
93}
94
95impl From<Block> for BlockDto {
96    fn from(entity: Block) -> Self {
97        BlockDto {
98            id: entity.id,
99            created_at: entity.created_at,
100            updated_at: entity.updated_at,
101            elements: entity.elements,
102            list: entity.list,
103            text_length: entity.text_length,
104            document_position: entity.document_position,
105            plain_text: entity.plain_text,
106            fmt_alignment: entity.fmt_alignment,
107            fmt_top_margin: entity.fmt_top_margin,
108            fmt_bottom_margin: entity.fmt_bottom_margin,
109            fmt_left_margin: entity.fmt_left_margin,
110            fmt_right_margin: entity.fmt_right_margin,
111            fmt_heading_level: entity.fmt_heading_level,
112            fmt_indent: entity.fmt_indent,
113            fmt_text_indent: entity.fmt_text_indent,
114            fmt_marker: entity.fmt_marker,
115            fmt_tab_positions: entity.fmt_tab_positions,
116            fmt_line_height: entity.fmt_line_height,
117            fmt_non_breakable_lines: entity.fmt_non_breakable_lines,
118            fmt_direction: entity.fmt_direction,
119            fmt_background_color: entity.fmt_background_color,
120        }
121    }
122}
123
124#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
125pub struct CreateBlockDto {
126    pub created_at: chrono::DateTime<chrono::Utc>,
127    pub updated_at: chrono::DateTime<chrono::Utc>,
128    pub elements: Vec<EntityId>,
129    pub list: Option<EntityId>,
130    pub text_length: i64,
131    pub document_position: i64,
132    pub plain_text: String,
133    pub fmt_alignment: Option<Alignment>,
134    pub fmt_top_margin: Option<i64>,
135    pub fmt_bottom_margin: Option<i64>,
136    pub fmt_left_margin: Option<i64>,
137    pub fmt_right_margin: Option<i64>,
138    pub fmt_heading_level: Option<i64>,
139    pub fmt_indent: Option<i64>,
140    pub fmt_text_indent: Option<i64>,
141    pub fmt_marker: Option<MarkerType>,
142    pub fmt_tab_positions: Vec<i64>,
143    pub fmt_line_height: Option<i64>,
144    pub fmt_non_breakable_lines: Option<bool>,
145    pub fmt_direction: Option<TextDirection>,
146    pub fmt_background_color: Option<String>,
147}
148
149impl From<CreateBlockDto> for Block {
150    fn from(dto: CreateBlockDto) -> Self {
151        Block {
152            id: 0,
153            created_at: dto.created_at,
154            updated_at: dto.updated_at,
155            elements: dto.elements,
156            list: dto.list,
157            text_length: dto.text_length,
158            document_position: dto.document_position,
159            plain_text: dto.plain_text,
160            fmt_alignment: dto.fmt_alignment,
161            fmt_top_margin: dto.fmt_top_margin,
162            fmt_bottom_margin: dto.fmt_bottom_margin,
163            fmt_left_margin: dto.fmt_left_margin,
164            fmt_right_margin: dto.fmt_right_margin,
165            fmt_heading_level: dto.fmt_heading_level,
166            fmt_indent: dto.fmt_indent,
167            fmt_text_indent: dto.fmt_text_indent,
168            fmt_marker: dto.fmt_marker,
169            fmt_tab_positions: dto.fmt_tab_positions,
170            fmt_line_height: dto.fmt_line_height,
171            fmt_non_breakable_lines: dto.fmt_non_breakable_lines,
172            fmt_direction: dto.fmt_direction,
173            fmt_background_color: dto.fmt_background_color,
174        }
175    }
176}
177
178impl From<&CreateBlockDto> for Block {
179    fn from(dto: &CreateBlockDto) -> Self {
180        Block {
181            id: 0,
182            created_at: dto.created_at,
183            updated_at: dto.updated_at,
184            elements: dto.elements.clone(),
185            list: dto.list,
186            text_length: dto.text_length,
187            document_position: dto.document_position,
188            plain_text: dto.plain_text.clone(),
189            fmt_alignment: dto.fmt_alignment.clone(),
190            fmt_top_margin: dto.fmt_top_margin,
191            fmt_bottom_margin: dto.fmt_bottom_margin,
192            fmt_left_margin: dto.fmt_left_margin,
193            fmt_right_margin: dto.fmt_right_margin,
194            fmt_heading_level: dto.fmt_heading_level,
195            fmt_indent: dto.fmt_indent,
196            fmt_text_indent: dto.fmt_text_indent,
197            fmt_marker: dto.fmt_marker.clone(),
198            fmt_tab_positions: dto.fmt_tab_positions.clone(),
199            fmt_line_height: dto.fmt_line_height,
200            fmt_non_breakable_lines: dto.fmt_non_breakable_lines,
201            fmt_direction: dto.fmt_direction.clone(),
202            fmt_background_color: dto.fmt_background_color.clone(),
203        }
204    }
205}
206
207impl From<Block> for CreateBlockDto {
208    fn from(entity: Block) -> Self {
209        CreateBlockDto {
210            created_at: entity.created_at,
211            updated_at: entity.updated_at,
212            elements: entity.elements,
213            list: entity.list,
214            text_length: entity.text_length,
215            document_position: entity.document_position,
216            plain_text: entity.plain_text,
217            fmt_alignment: entity.fmt_alignment,
218            fmt_top_margin: entity.fmt_top_margin,
219            fmt_bottom_margin: entity.fmt_bottom_margin,
220            fmt_left_margin: entity.fmt_left_margin,
221            fmt_right_margin: entity.fmt_right_margin,
222            fmt_heading_level: entity.fmt_heading_level,
223            fmt_indent: entity.fmt_indent,
224            fmt_text_indent: entity.fmt_text_indent,
225            fmt_marker: entity.fmt_marker,
226            fmt_tab_positions: entity.fmt_tab_positions,
227            fmt_line_height: entity.fmt_line_height,
228            fmt_non_breakable_lines: entity.fmt_non_breakable_lines,
229            fmt_direction: entity.fmt_direction,
230            fmt_background_color: entity.fmt_background_color,
231        }
232    }
233}
234
235#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
236pub struct UpdateBlockDto {
237    pub id: EntityId,
238    pub created_at: chrono::DateTime<chrono::Utc>,
239    pub updated_at: chrono::DateTime<chrono::Utc>,
240    pub text_length: i64,
241    pub document_position: i64,
242    pub plain_text: String,
243    pub fmt_alignment: Option<Alignment>,
244    pub fmt_top_margin: Option<i64>,
245    pub fmt_bottom_margin: Option<i64>,
246    pub fmt_left_margin: Option<i64>,
247    pub fmt_right_margin: Option<i64>,
248    pub fmt_heading_level: Option<i64>,
249    pub fmt_indent: Option<i64>,
250    pub fmt_text_indent: Option<i64>,
251    pub fmt_marker: Option<MarkerType>,
252    pub fmt_tab_positions: Vec<i64>,
253    pub fmt_line_height: Option<i64>,
254    pub fmt_non_breakable_lines: Option<bool>,
255    pub fmt_direction: Option<TextDirection>,
256    pub fmt_background_color: Option<String>,
257}
258
259impl From<UpdateBlockDto> for Block {
260    fn from(dto: UpdateBlockDto) -> Self {
261        Block {
262            id: dto.id,
263            created_at: dto.created_at,
264            updated_at: dto.updated_at,
265            text_length: dto.text_length,
266            document_position: dto.document_position,
267            plain_text: dto.plain_text,
268            fmt_alignment: dto.fmt_alignment,
269            fmt_top_margin: dto.fmt_top_margin,
270            fmt_bottom_margin: dto.fmt_bottom_margin,
271            fmt_left_margin: dto.fmt_left_margin,
272            fmt_right_margin: dto.fmt_right_margin,
273            fmt_heading_level: dto.fmt_heading_level,
274            fmt_indent: dto.fmt_indent,
275            fmt_text_indent: dto.fmt_text_indent,
276            fmt_marker: dto.fmt_marker,
277            fmt_tab_positions: dto.fmt_tab_positions,
278            fmt_line_height: dto.fmt_line_height,
279            fmt_non_breakable_lines: dto.fmt_non_breakable_lines,
280            fmt_direction: dto.fmt_direction,
281            fmt_background_color: dto.fmt_background_color,
282            elements: Default::default(),
283            list: Default::default(),
284        }
285    }
286}
287
288impl From<&UpdateBlockDto> for Block {
289    fn from(dto: &UpdateBlockDto) -> Self {
290        Block {
291            id: dto.id,
292            created_at: dto.created_at,
293            updated_at: dto.updated_at,
294            text_length: dto.text_length,
295            document_position: dto.document_position,
296            plain_text: dto.plain_text.clone(),
297            fmt_alignment: dto.fmt_alignment.clone(),
298            fmt_top_margin: dto.fmt_top_margin,
299            fmt_bottom_margin: dto.fmt_bottom_margin,
300            fmt_left_margin: dto.fmt_left_margin,
301            fmt_right_margin: dto.fmt_right_margin,
302            fmt_heading_level: dto.fmt_heading_level,
303            fmt_indent: dto.fmt_indent,
304            fmt_text_indent: dto.fmt_text_indent,
305            fmt_marker: dto.fmt_marker.clone(),
306            fmt_tab_positions: dto.fmt_tab_positions.clone(),
307            fmt_line_height: dto.fmt_line_height,
308            fmt_non_breakable_lines: dto.fmt_non_breakable_lines,
309            fmt_direction: dto.fmt_direction.clone(),
310            fmt_background_color: dto.fmt_background_color.clone(),
311            elements: Default::default(),
312            list: Default::default(),
313        }
314    }
315}
316
317impl From<Block> for UpdateBlockDto {
318    fn from(entity: Block) -> Self {
319        UpdateBlockDto {
320            id: entity.id,
321            created_at: entity.created_at,
322            updated_at: entity.updated_at,
323            text_length: entity.text_length,
324            document_position: entity.document_position,
325            plain_text: entity.plain_text,
326            fmt_alignment: entity.fmt_alignment,
327            fmt_top_margin: entity.fmt_top_margin,
328            fmt_bottom_margin: entity.fmt_bottom_margin,
329            fmt_left_margin: entity.fmt_left_margin,
330            fmt_right_margin: entity.fmt_right_margin,
331            fmt_heading_level: entity.fmt_heading_level,
332            fmt_indent: entity.fmt_indent,
333            fmt_text_indent: entity.fmt_text_indent,
334            fmt_marker: entity.fmt_marker,
335            fmt_tab_positions: entity.fmt_tab_positions,
336            fmt_line_height: entity.fmt_line_height,
337            fmt_non_breakable_lines: entity.fmt_non_breakable_lines,
338            fmt_direction: entity.fmt_direction,
339            fmt_background_color: entity.fmt_background_color,
340        }
341    }
342}
343
344impl From<BlockDto> for UpdateBlockDto {
345    fn from(dto: BlockDto) -> Self {
346        UpdateBlockDto {
347            id: dto.id,
348            created_at: dto.created_at,
349            updated_at: dto.updated_at,
350            text_length: dto.text_length,
351            document_position: dto.document_position,
352            plain_text: dto.plain_text,
353            fmt_alignment: dto.fmt_alignment,
354            fmt_top_margin: dto.fmt_top_margin,
355            fmt_bottom_margin: dto.fmt_bottom_margin,
356            fmt_left_margin: dto.fmt_left_margin,
357            fmt_right_margin: dto.fmt_right_margin,
358            fmt_heading_level: dto.fmt_heading_level,
359            fmt_indent: dto.fmt_indent,
360            fmt_text_indent: dto.fmt_text_indent,
361            fmt_marker: dto.fmt_marker,
362            fmt_tab_positions: dto.fmt_tab_positions,
363            fmt_line_height: dto.fmt_line_height,
364            fmt_non_breakable_lines: dto.fmt_non_breakable_lines,
365            fmt_direction: dto.fmt_direction,
366            fmt_background_color: dto.fmt_background_color,
367        }
368    }
369}
370pub use common::direct_access::block::BlockRelationshipField;
371
372#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
373pub struct BlockRelationshipDto {
374    pub id: EntityId,
375    pub field: BlockRelationshipField,
376    pub right_ids: Vec<EntityId>,
377}