aboutsummaryrefslogtreecommitdiff
path: root/src/models.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/models.rs')
-rw-r--r--src/models.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/models.rs b/src/models.rs
new file mode 100644
index 0000000..b7631a4
--- /dev/null
+++ b/src/models.rs
@@ -0,0 +1,27 @@
1use entity::users;
2use serde::Serialize;
3use utoipa::ToSchema;
4
5#[derive(Serialize, ToSchema)]
6#[schema(description = "Account information")]
7pub struct Account {
8 #[schema(examples(1))]
9 pub id: i64,
10 #[schema(examples("john_doe", "ivanov_ivan"))]
11 pub username: String,
12 #[schema(examples("John", "Иван"))]
13 pub first_name: String,
14 #[schema(examples("Doe", "Иванов"))]
15 pub last_name: String,
16}
17
18impl From<users::Model> for Account {
19 fn from(value: users::Model) -> Self {
20 Self {
21 id: value.id,
22 username: value.username,
23 first_name: value.first_name,
24 last_name: value.last_name,
25 }
26 }
27}