Add year to book model

This commit is contained in:
2023-10-26 13:03:30 +02:00
parent 8fe744920f
commit 5d8da5f29a
6 changed files with 830 additions and 796 deletions

View File

@@ -98,6 +98,7 @@ model Book {
uploaded DateTime @db.Date
is_deleted Boolean @default(false)
pages Int?
year Int @db.SmallInt @default(0)
source Source @relation(fields: [source_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "fk_books_sources_id_source")
book_annotation BookAnnotation?
book_authors BookAuthor[]

File diff suppressed because one or more lines are too long

View File

@@ -43,6 +43,7 @@ pub struct AuthorBook {
pub title: String,
pub lang: String,
pub file_type: String,
pub year: i32,
pub available_types: Vec<String>,
pub uploaded: String,
pub translators: Vec<Author>,
@@ -57,6 +58,7 @@ impl From<book::Data> for AuthorBook {
title,
lang,
file_type,
year,
uploaded,
translations,
book_sequences,
@@ -70,6 +72,7 @@ impl From<book::Data> for AuthorBook {
title,
lang,
file_type: file_type.clone(),
year,
available_types: get_available_types(file_type, source.unwrap().name),
uploaded: uploaded.format("%Y-%m-%d").to_string(),
translators: get_translators(translations),

View File

@@ -75,6 +75,7 @@ pub struct RemoteBook {
pub title: String,
pub lang: String,
pub file_type: String,
pub year: i32,
pub available_types: Vec<String>,
pub uploaded: String,
pub authors: Vec<Author>,
@@ -92,6 +93,7 @@ impl From<book::Data> for RemoteBook {
title,
lang,
file_type,
year,
uploaded,
book_authors,
translations,
@@ -107,6 +109,7 @@ impl From<book::Data> for RemoteBook {
title,
lang,
file_type: file_type.clone(),
year,
available_types: get_available_types(file_type, source.clone().unwrap().name),
uploaded: uploaded.format("%Y-%m-%d").to_string(),
authors: get_authors(book_authors),
@@ -147,6 +150,7 @@ pub struct DetailBook {
pub title: String,
pub lang: String,
pub file_type: String,
pub year: i32,
pub available_types: Vec<String>,
pub uploaded: String,
pub authors: Vec<Author>,
@@ -167,6 +171,7 @@ impl From<book::Data> for DetailBook {
title,
lang,
file_type,
year,
uploaded,
book_authors,
translations,
@@ -185,6 +190,7 @@ impl From<book::Data> for DetailBook {
title,
lang,
file_type: file_type.clone(),
year,
available_types: get_available_types(file_type, source.clone().unwrap().name),
uploaded: uploaded.format("%Y-%m-%d").to_string(),
authors: get_authors(book_authors),
@@ -212,6 +218,7 @@ pub struct Book {
pub title: String,
pub lang: String,
pub file_type: String,
pub year: i32,
pub available_types: Vec<String>,
pub uploaded: String,
pub authors: Vec<Author>,
@@ -227,6 +234,7 @@ impl From<book::Data> for Book {
title,
lang,
file_type,
year,
uploaded,
book_authors,
translations,
@@ -241,6 +249,7 @@ impl From<book::Data> for Book {
title,
lang,
file_type: file_type.clone(),
year,
available_types: get_available_types(file_type, source.clone().unwrap().name),
uploaded: uploaded.format("%Y-%m-%d").to_string(),
authors: get_authors(book_authors),

View File

@@ -27,6 +27,7 @@ pub struct SequenceBook {
pub title: String,
pub lang: String,
pub file_type: String,
pub year: i32,
pub available_types: Vec<String>,
pub uploaded: String,
pub authors: Vec<Author>,
@@ -41,6 +42,7 @@ impl From<book::Data> for SequenceBook {
title,
lang,
file_type,
year,
uploaded,
book_authors,
translations,
@@ -54,6 +56,7 @@ impl From<book::Data> for SequenceBook {
title,
lang,
file_type: file_type.clone(),
year,
available_types: get_available_types(file_type, source.clone().unwrap().name),
uploaded: uploaded.format("%Y-%m-%d").to_string(),
authors: get_authors(book_authors),

View File

@@ -14,6 +14,7 @@ pub struct TranslatorBook {
pub title: String,
pub lang: String,
pub file_type: String,
pub year: i32,
pub available_types: Vec<String>,
pub uploaded: String,
pub authors: Vec<Author>,
@@ -28,6 +29,7 @@ impl From<book::Data> for TranslatorBook {
title,
lang,
file_type,
year,
uploaded,
book_authors,
book_sequences,
@@ -41,6 +43,7 @@ impl From<book::Data> for TranslatorBook {
title,
lang,
file_type: file_type.clone(),
year,
available_types: get_available_types(file_type.clone(), source.unwrap().name),
uploaded: uploaded.format("%Y-%m-%d").to_string(),
authors: get_authors(book_authors),