mirror of
https://github.com/flibusta-apps/book_library_server.git
synced 2025-12-06 07:05:36 +01:00
Fix
This commit is contained in:
@@ -214,6 +214,7 @@ async fn get_author_books(
|
|||||||
b.year,
|
b.year,
|
||||||
CASE WHEN b.file_type = 'fb2' THEN ARRAY['fb2', 'epub', 'mobi', 'fb2zip']::text[] ELSE ARRAY[b.file_type]::text[] END AS "available_types!: Vec<String>",
|
CASE WHEN b.file_type = 'fb2' THEN ARRAY['fb2', 'epub', 'mobi', 'fb2zip']::text[] ELSE ARRAY[b.file_type]::text[] END AS "available_types!: Vec<String>",
|
||||||
b.uploaded,
|
b.uploaded,
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -230,7 +231,10 @@ async fn get_author_books(
|
|||||||
FROM translations
|
FROM translations
|
||||||
JOIN authors ON authors.id = translations.author
|
JOIN authors ON authors.id = translations.author
|
||||||
WHERE translations.book = b.id
|
WHERE translations.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::author_type[]
|
||||||
) AS "translators!: Vec<Author>",
|
) AS "translators!: Vec<Author>",
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -242,6 +246,8 @@ async fn get_author_books(
|
|||||||
FROM book_sequences
|
FROM book_sequences
|
||||||
JOIN sequences ON sequences.id = book_sequences.sequence
|
JOIN sequences ON sequences.id = book_sequences.sequence
|
||||||
WHERE book_sequences.book = b.id
|
WHERE book_sequences.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::sequence_type[]
|
||||||
) AS "sequences!: Vec<Sequence>",
|
) AS "sequences!: Vec<Sequence>",
|
||||||
EXISTS(
|
EXISTS(
|
||||||
SELECT * FROM book_annotations WHERE book = b.id
|
SELECT * FROM book_annotations WHERE book = b.id
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ pub async fn get_books(
|
|||||||
b.year,
|
b.year,
|
||||||
CASE WHEN b.file_type = 'fb2' THEN ARRAY['fb2', 'epub', 'mobi', 'fb2zip']::text[] ELSE ARRAY[b.file_type]::text[] END AS "available_types!: Vec<String>",
|
CASE WHEN b.file_type = 'fb2' THEN ARRAY['fb2', 'epub', 'mobi', 'fb2zip']::text[] ELSE ARRAY[b.file_type]::text[] END AS "available_types!: Vec<String>",
|
||||||
b.uploaded,
|
b.uploaded,
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -76,7 +77,10 @@ pub async fn get_books(
|
|||||||
FROM book_authors
|
FROM book_authors
|
||||||
JOIN authors ON authors.id = book_authors.author
|
JOIN authors ON authors.id = book_authors.author
|
||||||
WHERE book_authors.book = b.id
|
WHERE book_authors.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::author_type[]
|
||||||
) AS "authors!: Vec<Author>",
|
) AS "authors!: Vec<Author>",
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -93,7 +97,10 @@ pub async fn get_books(
|
|||||||
FROM translations
|
FROM translations
|
||||||
JOIN authors ON authors.id = translations.author
|
JOIN authors ON authors.id = translations.author
|
||||||
WHERE translations.book = b.id
|
WHERE translations.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::author_type[]
|
||||||
) AS "translators!: Vec<Author>",
|
) AS "translators!: Vec<Author>",
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -105,6 +112,8 @@ pub async fn get_books(
|
|||||||
FROM book_sequences
|
FROM book_sequences
|
||||||
JOIN sequences ON sequences.id = book_sequences.sequence
|
JOIN sequences ON sequences.id = book_sequences.sequence
|
||||||
WHERE book_sequences.book = b.id
|
WHERE book_sequences.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::sequence_type[]
|
||||||
) AS "sequences!: Vec<Sequence>",
|
) AS "sequences!: Vec<Sequence>",
|
||||||
EXISTS(
|
EXISTS(
|
||||||
SELECT * FROM book_annotations WHERE book = b.id
|
SELECT * FROM book_annotations WHERE book = b.id
|
||||||
@@ -243,6 +252,7 @@ pub async fn get_random_book(
|
|||||||
b.year,
|
b.year,
|
||||||
CASE WHEN b.file_type = 'fb2' THEN ARRAY['fb2', 'epub', 'mobi', 'fb2zip']::text[] ELSE ARRAY[b.file_type]::text[] END AS "available_types!: Vec<String>",
|
CASE WHEN b.file_type = 'fb2' THEN ARRAY['fb2', 'epub', 'mobi', 'fb2zip']::text[] ELSE ARRAY[b.file_type]::text[] END AS "available_types!: Vec<String>",
|
||||||
b.uploaded,
|
b.uploaded,
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -259,7 +269,10 @@ pub async fn get_random_book(
|
|||||||
FROM book_authors
|
FROM book_authors
|
||||||
JOIN authors ON authors.id = book_authors.author
|
JOIN authors ON authors.id = book_authors.author
|
||||||
WHERE book_authors.book = b.id
|
WHERE book_authors.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::author_type[]
|
||||||
) AS "authors!: Vec<Author>",
|
) AS "authors!: Vec<Author>",
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -276,7 +289,10 @@ pub async fn get_random_book(
|
|||||||
FROM translations
|
FROM translations
|
||||||
JOIN authors ON authors.id = translations.author
|
JOIN authors ON authors.id = translations.author
|
||||||
WHERE translations.book = b.id
|
WHERE translations.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::author_type[]
|
||||||
) AS "translators!: Vec<Author>",
|
) AS "translators!: Vec<Author>",
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -288,7 +304,10 @@ pub async fn get_random_book(
|
|||||||
FROM book_sequences
|
FROM book_sequences
|
||||||
JOIN sequences ON sequences.id = book_sequences.sequence
|
JOIN sequences ON sequences.id = book_sequences.sequence
|
||||||
WHERE book_sequences.book = b.id
|
WHERE book_sequences.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::sequence_type[]
|
||||||
) AS "sequences!: Vec<Sequence>",
|
) AS "sequences!: Vec<Sequence>",
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -308,6 +327,8 @@ pub async fn get_random_book(
|
|||||||
JOIN genres ON genres.id = book_genres.genre
|
JOIN genres ON genres.id = book_genres.genre
|
||||||
JOIN sources ON sources.id = genres.source
|
JOIN sources ON sources.id = genres.source
|
||||||
WHERE book_genres.book = b.id
|
WHERE book_genres.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::genre_type[]
|
||||||
) AS "genres!: Vec<Genre>",
|
) AS "genres!: Vec<Genre>",
|
||||||
EXISTS(
|
EXISTS(
|
||||||
SELECT * FROM book_annotations WHERE book = b.id
|
SELECT * FROM book_annotations WHERE book = b.id
|
||||||
@@ -352,6 +373,7 @@ pub async fn get_remote_book(
|
|||||||
b.year,
|
b.year,
|
||||||
CASE WHEN b.file_type = 'fb2' THEN ARRAY['fb2', 'epub', 'mobi', 'fb2zip']::text[] ELSE ARRAY[b.file_type]::text[] END AS "available_types!: Vec<String>",
|
CASE WHEN b.file_type = 'fb2' THEN ARRAY['fb2', 'epub', 'mobi', 'fb2zip']::text[] ELSE ARRAY[b.file_type]::text[] END AS "available_types!: Vec<String>",
|
||||||
b.uploaded,
|
b.uploaded,
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -368,7 +390,10 @@ pub async fn get_remote_book(
|
|||||||
FROM book_authors
|
FROM book_authors
|
||||||
JOIN authors ON authors.id = book_authors.author
|
JOIN authors ON authors.id = book_authors.author
|
||||||
WHERE book_authors.book = b.id
|
WHERE book_authors.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::author_type[]
|
||||||
) AS "authors!: Vec<Author>",
|
) AS "authors!: Vec<Author>",
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -385,7 +410,10 @@ pub async fn get_remote_book(
|
|||||||
FROM translations
|
FROM translations
|
||||||
JOIN authors ON authors.id = translations.author
|
JOIN authors ON authors.id = translations.author
|
||||||
WHERE translations.book = b.id
|
WHERE translations.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::author_type[]
|
||||||
) AS "translators!: Vec<Author>",
|
) AS "translators!: Vec<Author>",
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -397,7 +425,10 @@ pub async fn get_remote_book(
|
|||||||
FROM book_sequences
|
FROM book_sequences
|
||||||
JOIN sequences ON sequences.id = book_sequences.sequence
|
JOIN sequences ON sequences.id = book_sequences.sequence
|
||||||
WHERE book_sequences.book = b.id
|
WHERE book_sequences.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::sequence_type[]
|
||||||
) AS "sequences!: Vec<Sequence>",
|
) AS "sequences!: Vec<Sequence>",
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -417,6 +448,8 @@ pub async fn get_remote_book(
|
|||||||
JOIN genres ON genres.id = book_genres.genre
|
JOIN genres ON genres.id = book_genres.genre
|
||||||
JOIN sources ON sources.id = genres.source
|
JOIN sources ON sources.id = genres.source
|
||||||
WHERE book_genres.book = b.id
|
WHERE book_genres.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::genre_type[]
|
||||||
) AS "genres!: Vec<Genre>",
|
) AS "genres!: Vec<Genre>",
|
||||||
EXISTS(
|
EXISTS(
|
||||||
SELECT * FROM book_annotations WHERE book = b.id
|
SELECT * FROM book_annotations WHERE book = b.id
|
||||||
@@ -491,6 +524,7 @@ pub async fn search_books(
|
|||||||
b.year,
|
b.year,
|
||||||
CASE WHEN b.file_type = 'fb2' THEN ARRAY['fb2', 'epub', 'mobi', 'fb2zip']::text[] ELSE ARRAY[b.file_type]::text[] END AS "available_types!: Vec<String>",
|
CASE WHEN b.file_type = 'fb2' THEN ARRAY['fb2', 'epub', 'mobi', 'fb2zip']::text[] ELSE ARRAY[b.file_type]::text[] END AS "available_types!: Vec<String>",
|
||||||
b.uploaded,
|
b.uploaded,
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -507,7 +541,10 @@ pub async fn search_books(
|
|||||||
FROM book_authors
|
FROM book_authors
|
||||||
JOIN authors ON authors.id = book_authors.author
|
JOIN authors ON authors.id = book_authors.author
|
||||||
WHERE book_authors.book = b.id
|
WHERE book_authors.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::author_type[]
|
||||||
) AS "authors!: Vec<Author>",
|
) AS "authors!: Vec<Author>",
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -524,7 +561,10 @@ pub async fn search_books(
|
|||||||
FROM translations
|
FROM translations
|
||||||
JOIN authors ON authors.id = translations.author
|
JOIN authors ON authors.id = translations.author
|
||||||
WHERE translations.book = b.id
|
WHERE translations.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::author_type[]
|
||||||
) AS "translators!: Vec<Author>",
|
) AS "translators!: Vec<Author>",
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -536,6 +576,8 @@ pub async fn search_books(
|
|||||||
FROM book_sequences
|
FROM book_sequences
|
||||||
JOIN sequences ON sequences.id = book_sequences.sequence
|
JOIN sequences ON sequences.id = book_sequences.sequence
|
||||||
WHERE book_sequences.book = b.id
|
WHERE book_sequences.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::sequence_type[]
|
||||||
) AS "sequences!: Vec<Sequence>",
|
) AS "sequences!: Vec<Sequence>",
|
||||||
EXISTS(
|
EXISTS(
|
||||||
SELECT * FROM book_annotations WHERE book = b.id
|
SELECT * FROM book_annotations WHERE book = b.id
|
||||||
@@ -573,6 +615,7 @@ pub async fn get_book(db: Database, Path(book_id): Path<i32>) -> impl IntoRespon
|
|||||||
b.year,
|
b.year,
|
||||||
CASE WHEN b.file_type = 'fb2' THEN ARRAY['fb2', 'epub', 'mobi', 'fb2zip']::text[] ELSE ARRAY[b.file_type]::text[] END AS "available_types!: Vec<String>",
|
CASE WHEN b.file_type = 'fb2' THEN ARRAY['fb2', 'epub', 'mobi', 'fb2zip']::text[] ELSE ARRAY[b.file_type]::text[] END AS "available_types!: Vec<String>",
|
||||||
b.uploaded,
|
b.uploaded,
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -589,7 +632,10 @@ pub async fn get_book(db: Database, Path(book_id): Path<i32>) -> impl IntoRespon
|
|||||||
FROM book_authors
|
FROM book_authors
|
||||||
JOIN authors ON authors.id = book_authors.author
|
JOIN authors ON authors.id = book_authors.author
|
||||||
WHERE book_authors.book = b.id
|
WHERE book_authors.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::author_type[]
|
||||||
) AS "authors!: Vec<Author>",
|
) AS "authors!: Vec<Author>",
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -606,7 +652,10 @@ pub async fn get_book(db: Database, Path(book_id): Path<i32>) -> impl IntoRespon
|
|||||||
FROM translations
|
FROM translations
|
||||||
JOIN authors ON authors.id = translations.author
|
JOIN authors ON authors.id = translations.author
|
||||||
WHERE translations.book = b.id
|
WHERE translations.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::author_type[]
|
||||||
) AS "translators!: Vec<Author>",
|
) AS "translators!: Vec<Author>",
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -618,7 +667,10 @@ pub async fn get_book(db: Database, Path(book_id): Path<i32>) -> impl IntoRespon
|
|||||||
FROM book_sequences
|
FROM book_sequences
|
||||||
JOIN sequences ON sequences.id = book_sequences.sequence
|
JOIN sequences ON sequences.id = book_sequences.sequence
|
||||||
WHERE book_sequences.book = b.id
|
WHERE book_sequences.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::sequence_type[]
|
||||||
) AS "sequences!: Vec<Sequence>",
|
) AS "sequences!: Vec<Sequence>",
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -638,6 +690,8 @@ pub async fn get_book(db: Database, Path(book_id): Path<i32>) -> impl IntoRespon
|
|||||||
JOIN genres ON genres.id = book_genres.genre
|
JOIN genres ON genres.id = book_genres.genre
|
||||||
JOIN sources ON sources.id = genres.source
|
JOIN sources ON sources.id = genres.source
|
||||||
WHERE book_genres.book = b.id
|
WHERE book_genres.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::genre_type[]
|
||||||
) AS "genres!: Vec<Genre>",
|
) AS "genres!: Vec<Genre>",
|
||||||
EXISTS(
|
EXISTS(
|
||||||
SELECT * FROM book_annotations WHERE book = b.id
|
SELECT * FROM book_annotations WHERE book = b.id
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ async fn get_sequence_books(
|
|||||||
b.year,
|
b.year,
|
||||||
CASE WHEN b.file_type = 'fb2' THEN ARRAY['fb2', 'epub', 'mobi', 'fb2zip']::text[] ELSE ARRAY[b.file_type]::text[] END AS "available_types!: Vec<String>",
|
CASE WHEN b.file_type = 'fb2' THEN ARRAY['fb2', 'epub', 'mobi', 'fb2zip']::text[] ELSE ARRAY[b.file_type]::text[] END AS "available_types!: Vec<String>",
|
||||||
b.uploaded,
|
b.uploaded,
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -229,7 +230,10 @@ async fn get_sequence_books(
|
|||||||
FROM book_authors
|
FROM book_authors
|
||||||
JOIN authors ON authors.id = book_authors.author
|
JOIN authors ON authors.id = book_authors.author
|
||||||
WHERE book_authors.book = b.id
|
WHERE book_authors.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::author_type[]
|
||||||
) AS "authors!: Vec<Author>",
|
) AS "authors!: Vec<Author>",
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -246,6 +250,8 @@ async fn get_sequence_books(
|
|||||||
FROM translations
|
FROM translations
|
||||||
JOIN authors ON authors.id = translations.author
|
JOIN authors ON authors.id = translations.author
|
||||||
WHERE translations.book = b.id
|
WHERE translations.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::author_type[]
|
||||||
) AS "translators!: Vec<Author>",
|
) AS "translators!: Vec<Author>",
|
||||||
EXISTS(
|
EXISTS(
|
||||||
SELECT * FROM book_annotations WHERE book = b.id
|
SELECT * FROM book_annotations WHERE book = b.id
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ async fn get_translated_books(
|
|||||||
b.year,
|
b.year,
|
||||||
CASE WHEN b.file_type = 'fb2' THEN ARRAY['fb2', 'epub', 'mobi', 'fb2zip']::text[] ELSE ARRAY[b.file_type]::text[] END AS "available_types!: Vec<String>",
|
CASE WHEN b.file_type = 'fb2' THEN ARRAY['fb2', 'epub', 'mobi', 'fb2zip']::text[] ELSE ARRAY[b.file_type]::text[] END AS "available_types!: Vec<String>",
|
||||||
b.uploaded,
|
b.uploaded,
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -102,7 +103,10 @@ async fn get_translated_books(
|
|||||||
FROM book_authors
|
FROM book_authors
|
||||||
JOIN authors ON authors.id = book_authors.author
|
JOIN authors ON authors.id = book_authors.author
|
||||||
WHERE book_authors.book = b.id
|
WHERE book_authors.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::author_type[]
|
||||||
) AS "authors!: Vec<Author>",
|
) AS "authors!: Vec<Author>",
|
||||||
|
COALESCE(
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
ARRAY_AGG(
|
ARRAY_AGG(
|
||||||
@@ -114,6 +118,8 @@ async fn get_translated_books(
|
|||||||
FROM book_sequences
|
FROM book_sequences
|
||||||
JOIN sequences ON sequences.id = book_sequences.sequence
|
JOIN sequences ON sequences.id = book_sequences.sequence
|
||||||
WHERE book_sequences.book = b.id
|
WHERE book_sequences.book = b.id
|
||||||
|
),
|
||||||
|
ARRAY[]::sequence_type[]
|
||||||
) AS "sequences!: Vec<Sequence>",
|
) AS "sequences!: Vec<Sequence>",
|
||||||
EXISTS(
|
EXISTS(
|
||||||
SELECT * FROM book_annotations WHERE book = b.id
|
SELECT * FROM book_annotations WHERE book = b.id
|
||||||
|
|||||||
Reference in New Issue
Block a user