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
|
use entity::{queues, users};
use serde::Serialize;
use utoipa::ToSchema;
#[derive(Serialize, ToSchema)]
#[schema(description = "Account information")]
pub struct Account {
#[schema(examples(1))]
pub id: i64,
#[schema(examples("john_doe", "ivanov_ivan"))]
pub username: String,
#[schema(examples("John", "Иван"))]
pub first_name: String,
#[schema(examples("Doe", "Иванов"))]
pub last_name: String,
}
impl From<users::Model> for Account {
fn from(value: users::Model) -> Self {
Self {
id: value.id,
username: value.username,
first_name: value.first_name,
last_name: value.last_name,
}
}
}
#[derive(Serialize, ToSchema)]
pub struct Queue {
#[schema(examples(1))]
pub id: i64,
#[schema(examples("John's queue", "Очередь Ивана"))]
pub name: String,
}
impl From<queues::Model> for Queue {
fn from(value: queues::Model) -> Self {
Self {
id: value.id,
name: value.name,
}
}
}
|