1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/// Defines default Data Transfer Auxiliary structs
///
/// This module contains all the auxiliary structs used to transfer data between
/// layers. These structs are used to transfer data between layers and are not
/// intended to be used as entities.
///
/// # Examples
///
/// If you want to create two related structs with database representations and
/// the relationship between them is established by a foreign key, you can use
/// Parent and Children.
///
/// ```
/// use mycelium_base::dtos::{Children, Parent};
/// use serde::{Deserialize, Serialize};
/// use utoipa::ToSchema;
///
/// #[derive(Debug, Deserialize, Serialize, Eq, PartialEq, ToSchema)]
/// struct Post {
/// id: i32,
/// title: String,
/// comments: Children<Comment, i32>,
/// };
///
/// #[derive(Debug, Deserialize, Serialize, Eq, PartialEq, ToSchema)]
/// struct Comment {
/// post: Parent<Post, i32>,
/// id: i32,
/// text: String,
/// };
///
/// let post_with_comments_as_ids = Post {
/// id: 1,
/// title: "Hello World".to_string(),
/// comments: Children::Ids(vec![1, 2, 3]),
/// };
///
/// let post_with_comments_as_records = Post {
/// id: 1,
/// title: "Hello World".to_string(),
/// comments: Children::Records(vec![
/// Comment {
/// post: Parent::Id(1),
/// id: 1,
/// text: "Hello World from comment 1".to_string(),
/// },
/// Comment {
/// post: Parent::Id(1),
/// id: 2,
/// text: "Hello World from comment 2".to_string(),
/// },
/// Comment {
/// post: Parent::Id(1),
/// id: 3,
/// text: "Hello World from comment 3".to_string(),
/// },
/// ]),
/// };
/// ```
///
/// Defines default entities for clean architecture based projects
///
/// This module contains all the entities used in the project. Entities are
/// the core of the project and are used to represent the business logic.
/// Entities are not intended to be used as Data Transfer Objects.
/// Defines common utilities for error management
///
/// This module contains all the utilities used to manage errors in the project.
/// These utilities are used to manage errors in a clean way.