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