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