This commit is contained in:
2024-12-26 01:28:32 +01:00
parent 3e8500e825
commit c58e10bfa0
29 changed files with 1622 additions and 865 deletions

View File

@@ -215,16 +215,16 @@ async fn get_sequence_books(
b.uploaded,
(
SELECT
JSONB_AGG(
JSONB_BUILD_OBJECT(
'id', authors.id,
'first_name', authors.first_name,
'last_name', authors.last_name,
'middle_name', authors.middle_name,
'annotation_exists', EXISTS(
ARRAY_AGG(
ROW(
authors.id,
authors.first_name,
authors.last_name,
authors.middle_name,
EXISTS(
SELECT * FROM author_annotations WHERE author = authors.id
)
)
)::author_type
)
FROM book_authors
JOIN authors ON authors.id = book_authors.author
@@ -232,16 +232,16 @@ async fn get_sequence_books(
) AS "authors!: Vec<Author>",
(
SELECT
JSONB_AGG(
JSONB_BUILD_OBJECT(
'id', authors.id,
'first_name', authors.first_name,
'last_name', authors.last_name,
'middle_name', authors.middle_name,
'annotation_exists', EXISTS(
ARRAY_AGG(
ROW(
authors.id,
authors.first_name,
authors.last_name,
authors.middle_name,
EXISTS(
SELECT * FROM author_annotations WHERE author = authors.id
)
)
)::author_type
)
FROM translations
JOIN authors ON authors.id = translations.author