mirror of
https://github.com/flibusta-apps/book_library_server.git
synced 2025-12-06 15:15:36 +01:00
31 lines
762 B
Rust
31 lines
762 B
Rust
use chrono::NaiveDate;
|
|
use serde::Serialize;
|
|
|
|
use super::date::naive_date_serializer;
|
|
use super::sequence::Sequence;
|
|
|
|
#[derive(sqlx::FromRow, sqlx::Type, Serialize)]
|
|
#[sqlx(type_name = "author_type")]
|
|
pub struct Author {
|
|
pub id: i32,
|
|
pub first_name: String,
|
|
pub last_name: String,
|
|
pub middle_name: String,
|
|
pub annotation_exists: bool,
|
|
}
|
|
|
|
#[derive(sqlx::FromRow, Serialize)]
|
|
pub struct AuthorBook {
|
|
pub id: i32,
|
|
pub title: String,
|
|
pub lang: String,
|
|
pub file_type: String,
|
|
pub year: i32,
|
|
pub available_types: Vec<String>,
|
|
#[serde(serialize_with = "naive_date_serializer::serialize")]
|
|
pub uploaded: NaiveDate,
|
|
pub translators: Vec<Author>,
|
|
pub sequences: Vec<Sequence>,
|
|
pub annotation_exists: bool,
|
|
}
|