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 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 for Queue { fn from(value: queues::Model) -> Self { Self { id: value.id, name: value.name, } } }