This commit is contained in:
2024-12-26 00:03:51 +01:00
parent f938516f65
commit 52ab9b361d
24 changed files with 650 additions and 650 deletions

View File

@@ -0,0 +1,85 @@
{
"db_name": "PostgreSQL",
"query": "\n SELECT\n b.id,\n b.title,\n b.lang,\n b.file_type,\n b.year,\n 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>\",\n b.uploaded,\n (\n SELECT\n JSONB_AGG(\n JSONB_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM book_authors\n JOIN authors ON authors.id = book_authors.author\n WHERE book_authors.book = b.id\n ) AS \"authors!: Vec<Author>\",\n (\n SELECT\n JSONB_AGG(\n JSONB_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM translations\n JOIN authors ON authors.id = translations.author\n WHERE translations.book = b.id\n ) AS \"translators!: Vec<Author>\",\n EXISTS(\n SELECT * FROM book_annotations WHERE book = b.id\n ) AS \"annotation_exists!: bool\",\n bs.position\n FROM books b\n JOIN book_sequences bs ON b.id = bs.book\n WHERE\n b.is_deleted = FALSE AND\n bs.sequence = $1 AND\n b.lang = ANY($2)\n ORDER BY bs.position\n LIMIT $3 OFFSET $4\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id",
"type_info": "Int4"
},
{
"ordinal": 1,
"name": "title",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "lang",
"type_info": "Varchar"
},
{
"ordinal": 3,
"name": "file_type",
"type_info": "Varchar"
},
{
"ordinal": 4,
"name": "year",
"type_info": "Int2"
},
{
"ordinal": 5,
"name": "available_types!: Vec<String>",
"type_info": "TextArray"
},
{
"ordinal": 6,
"name": "uploaded",
"type_info": "Date"
},
{
"ordinal": 7,
"name": "authors!: Vec<Author>",
"type_info": "Jsonb"
},
{
"ordinal": 8,
"name": "translators!: Vec<Author>",
"type_info": "Jsonb"
},
{
"ordinal": 9,
"name": "annotation_exists!: bool",
"type_info": "Bool"
},
{
"ordinal": 10,
"name": "position",
"type_info": "Int2"
}
],
"parameters": {
"Left": [
"Int4",
"TextArray",
"Int8",
"Int8"
]
},
"nullable": [
false,
false,
false,
false,
false,
null,
false,
null,
null,
null,
false
]
},
"hash": "0644481879afc3abad9188fde0b00d19638ff16d6c8678d8d4e54a4b6bf5393d"
}

View File

@@ -1,85 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n SELECT\n b.id,\n b.title,\n b.lang,\n b.file_type,\n b.year,\n 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>\",\n b.uploaded,\n (\n SELECT\n JSON_AGG(\n JSON_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM book_authors\n JOIN authors ON authors.id = book_authors.author\n WHERE book_authors.book = b.id\n ) AS \"authors!: Vec<Author>\",\n (\n SELECT\n JSON_AGG(\n JSON_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM translations\n JOIN authors ON authors.id = translations.author\n WHERE translations.book = b.id\n ) AS \"translators!: Vec<Author>\",\n EXISTS(\n SELECT * FROM book_annotations WHERE book = b.id\n ) AS \"annotation_exists!: bool\",\n bs.position\n FROM books b\n JOIN book_sequences bs ON b.id = bs.book\n WHERE\n b.is_deleted = FALSE AND\n bs.sequence = $1 AND\n b.lang = ANY($2)\n ORDER BY bs.position\n LIMIT $3 OFFSET $4\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id",
"type_info": "Int4"
},
{
"ordinal": 1,
"name": "title",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "lang",
"type_info": "Varchar"
},
{
"ordinal": 3,
"name": "file_type",
"type_info": "Varchar"
},
{
"ordinal": 4,
"name": "year",
"type_info": "Int2"
},
{
"ordinal": 5,
"name": "available_types!: Vec<String>",
"type_info": "TextArray"
},
{
"ordinal": 6,
"name": "uploaded",
"type_info": "Date"
},
{
"ordinal": 7,
"name": "authors!: Vec<Author>",
"type_info": "Json"
},
{
"ordinal": 8,
"name": "translators!: Vec<Author>",
"type_info": "Json"
},
{
"ordinal": 9,
"name": "annotation_exists!: bool",
"type_info": "Bool"
},
{
"ordinal": 10,
"name": "position",
"type_info": "Int2"
}
],
"parameters": {
"Left": [
"Int4",
"TextArray",
"Int8",
"Int8"
]
},
"nullable": [
false,
false,
false,
false,
false,
null,
false,
null,
null,
null,
false
]
},
"hash": "34c2b0f605eddd776433543f2a553324ab61277083a0b6a41f1c43edc596ed60"
}

View File

@@ -1,112 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n SELECT\n b.id,\n b.title,\n b.lang,\n b.file_type,\n b.year,\n 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>\",\n b.uploaded,\n (\n SELECT\n JSON_AGG(\n JSON_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM book_authors\n JOIN authors ON authors.id = book_authors.author\n WHERE book_authors.book = b.id\n ) AS \"authors!: Vec<Author>\",\n (\n SELECT\n JSON_AGG(\n JSON_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM translations\n JOIN authors ON authors.id = translations.author\n WHERE translations.book = b.id\n ) AS \"translators!: Vec<Author>\",\n (\n SELECT\n JSON_AGG(\n JSON_BUILD_OBJECT(\n 'id', sequences.id,\n 'name', sequences.name\n )\n )\n FROM book_sequences\n JOIN sequences ON sequences.id = book_sequences.sequence\n WHERE book_sequences.book = b.id\n ) AS \"sequences!: Vec<Sequence>\",\n (\n SELECT\n JSON_AGG(\n JSON_BUILD_OBJECT(\n 'id', genres.id,\n 'code', genres.code,\n 'description', genres.description,\n 'meta', genres.meta,\n 'source', JSON_BUILD_OBJECT(\n 'id', sources.id,\n 'name', sources.name\n )\n )\n )\n FROM book_genres\n JOIN genres ON genres.id = book_genres.genre\n JOIN sources ON sources.id = genres.source\n WHERE book_genres.book = b.id\n ) AS \"genres!: Vec<Genre>\",\n EXISTS(\n SELECT * FROM book_annotations WHERE book = b.id\n ) AS \"annotation_exists!: bool\",\n (\n SELECT\n JSON_BUILD_OBJECT(\n 'id', sources.id,\n 'name', sources.name\n )\n FROM sources\n WHERE sources.id = b.source\n ) AS \"source!: Source\",\n b.remote_id,\n b.is_deleted,\n b.pages\n FROM books b\n WHERE b.id = $1\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id",
"type_info": "Int4"
},
{
"ordinal": 1,
"name": "title",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "lang",
"type_info": "Varchar"
},
{
"ordinal": 3,
"name": "file_type",
"type_info": "Varchar"
},
{
"ordinal": 4,
"name": "year",
"type_info": "Int2"
},
{
"ordinal": 5,
"name": "available_types!: Vec<String>",
"type_info": "TextArray"
},
{
"ordinal": 6,
"name": "uploaded",
"type_info": "Date"
},
{
"ordinal": 7,
"name": "authors!: Vec<Author>",
"type_info": "Json"
},
{
"ordinal": 8,
"name": "translators!: Vec<Author>",
"type_info": "Json"
},
{
"ordinal": 9,
"name": "sequences!: Vec<Sequence>",
"type_info": "Json"
},
{
"ordinal": 10,
"name": "genres!: Vec<Genre>",
"type_info": "Json"
},
{
"ordinal": 11,
"name": "annotation_exists!: bool",
"type_info": "Bool"
},
{
"ordinal": 12,
"name": "source!: Source",
"type_info": "Json"
},
{
"ordinal": 13,
"name": "remote_id",
"type_info": "Int4"
},
{
"ordinal": 14,
"name": "is_deleted",
"type_info": "Bool"
},
{
"ordinal": 15,
"name": "pages",
"type_info": "Int4"
}
],
"parameters": {
"Left": [
"Int4"
]
},
"nullable": [
false,
false,
false,
false,
false,
null,
false,
null,
null,
null,
null,
null,
null,
false,
false,
true
]
},
"hash": "3bf3d8ef40b6832eeeb1b5e01a3d7b5ce9586fad68f8f502adfb3cd2f372f0c8"
}

View File

@@ -0,0 +1,112 @@
{
"db_name": "PostgreSQL",
"query": "\n SELECT\n b.id,\n b.title,\n b.lang,\n b.file_type,\n b.year,\n 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>\",\n b.uploaded,\n (\n SELECT\n JSONB_AGG(\n JSONB_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM book_authors\n JOIN authors ON authors.id = book_authors.author\n WHERE book_authors.book = b.id\n ) AS \"authors!: Vec<Author>\",\n (\n SELECT\n JSONB_AGG(\n JSONB_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM translations\n JOIN authors ON authors.id = translations.author\n WHERE translations.book = b.id\n ) AS \"translators!: Vec<Author>\",\n (\n SELECT\n JSONB_AGG(\n JSONB_BUILD_OBJECT(\n 'id', sequences.id,\n 'name', sequences.name\n )\n )\n FROM book_sequences\n JOIN sequences ON sequences.id = book_sequences.sequence\n WHERE book_sequences.book = b.id\n ) AS \"sequences!: Vec<Sequence>\",\n (\n SELECT\n JSONB_AGG(\n JSONB_BUILD_OBJECT(\n 'id', genres.id,\n 'code', genres.code,\n 'description', genres.description,\n 'meta', genres.meta,\n 'source', JSONB_BUILD_OBJECT(\n 'id', sources.id,\n 'name', sources.name\n )\n )\n )\n FROM book_genres\n JOIN genres ON genres.id = book_genres.genre\n JOIN sources ON sources.id = genres.source\n WHERE book_genres.book = b.id\n ) AS \"genres!: Vec<Genre>\",\n EXISTS(\n SELECT * FROM book_annotations WHERE book = b.id\n ) AS \"annotation_exists!: bool\",\n (\n SELECT\n JSONB_BUILD_OBJECT(\n 'id', sources.id,\n 'name', sources.name\n )\n FROM sources\n WHERE sources.id = b.source\n ) AS \"source!: Source\",\n b.remote_id,\n b.is_deleted,\n b.pages\n FROM books b\n WHERE b.id = $1\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id",
"type_info": "Int4"
},
{
"ordinal": 1,
"name": "title",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "lang",
"type_info": "Varchar"
},
{
"ordinal": 3,
"name": "file_type",
"type_info": "Varchar"
},
{
"ordinal": 4,
"name": "year",
"type_info": "Int2"
},
{
"ordinal": 5,
"name": "available_types!: Vec<String>",
"type_info": "TextArray"
},
{
"ordinal": 6,
"name": "uploaded",
"type_info": "Date"
},
{
"ordinal": 7,
"name": "authors!: Vec<Author>",
"type_info": "Jsonb"
},
{
"ordinal": 8,
"name": "translators!: Vec<Author>",
"type_info": "Jsonb"
},
{
"ordinal": 9,
"name": "sequences!: Vec<Sequence>",
"type_info": "Jsonb"
},
{
"ordinal": 10,
"name": "genres!: Vec<Genre>",
"type_info": "Jsonb"
},
{
"ordinal": 11,
"name": "annotation_exists!: bool",
"type_info": "Bool"
},
{
"ordinal": 12,
"name": "source!: Source",
"type_info": "Jsonb"
},
{
"ordinal": 13,
"name": "remote_id",
"type_info": "Int4"
},
{
"ordinal": 14,
"name": "is_deleted",
"type_info": "Bool"
},
{
"ordinal": 15,
"name": "pages",
"type_info": "Int4"
}
],
"parameters": {
"Left": [
"Int4"
]
},
"nullable": [
false,
false,
false,
false,
false,
null,
false,
null,
null,
null,
null,
null,
null,
false,
false,
true
]
},
"hash": "52cef4b1366f8071f42b772cfe32489050ce4d0b395cb0c93944389b1dfa8251"
}

View File

@@ -1,101 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n SELECT\n b.id,\n b.title,\n b.lang,\n b.file_type,\n b.year,\n 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>\",\n b.uploaded,\n (\n SELECT\n JSON_AGG(\n JSON_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM book_authors\n JOIN authors ON authors.id = book_authors.author\n WHERE book_authors.book = b.id\n ) AS \"authors!: Vec<Author>\",\n (\n SELECT\n JSON_AGG(\n JSON_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM translations\n JOIN authors ON authors.id = translations.author\n WHERE translations.book = b.id\n ) AS \"translators!: Vec<Author>\",\n (\n SELECT\n JSON_AGG(\n JSON_BUILD_OBJECT(\n 'id', sequences.id,\n 'name', sequences.name\n )\n )\n FROM book_sequences\n JOIN sequences ON sequences.id = book_sequences.sequence\n WHERE book_sequences.book = b.id\n ) AS \"sequences!: Vec<Sequence>\",\n EXISTS(\n SELECT * FROM book_annotations WHERE book = b.id\n ) AS \"annotation_exists!: bool\",\n (\n SELECT\n JSON_BUILD_OBJECT(\n 'id', sources.id,\n 'name', sources.name\n )\n FROM sources\n WHERE sources.id = b.source\n ) AS \"source!: Source\",\n b.remote_id\n FROM books b\n WHERE lang = ANY($1) AND\n ($2::boolean IS NULL OR is_deleted = $2) AND\n ($3::date IS NULL OR uploaded >= $3) AND\n ($4::date IS NULL OR uploaded <= $4) AND\n ($5::integer IS NULL OR id >= $5) AND\n ($6::integer IS NULL OR id <= $6)\n ORDER BY b.id ASC\n OFFSET $7\n LIMIT $8\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id",
"type_info": "Int4"
},
{
"ordinal": 1,
"name": "title",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "lang",
"type_info": "Varchar"
},
{
"ordinal": 3,
"name": "file_type",
"type_info": "Varchar"
},
{
"ordinal": 4,
"name": "year",
"type_info": "Int2"
},
{
"ordinal": 5,
"name": "available_types!: Vec<String>",
"type_info": "TextArray"
},
{
"ordinal": 6,
"name": "uploaded",
"type_info": "Date"
},
{
"ordinal": 7,
"name": "authors!: Vec<Author>",
"type_info": "Json"
},
{
"ordinal": 8,
"name": "translators!: Vec<Author>",
"type_info": "Json"
},
{
"ordinal": 9,
"name": "sequences!: Vec<Sequence>",
"type_info": "Json"
},
{
"ordinal": 10,
"name": "annotation_exists!: bool",
"type_info": "Bool"
},
{
"ordinal": 11,
"name": "source!: Source",
"type_info": "Json"
},
{
"ordinal": 12,
"name": "remote_id",
"type_info": "Int4"
}
],
"parameters": {
"Left": [
"TextArray",
"Bool",
"Date",
"Date",
"Int4",
"Int4",
"Int8",
"Int8"
]
},
"nullable": [
false,
false,
false,
false,
false,
null,
false,
null,
null,
null,
null,
null,
false
]
},
"hash": "5d232f0a9a4cd5bb05d5d246af878bb43fb042f8643bb1a9b98dbafde4fbf50b"
}

View File

@@ -1,6 +1,6 @@
{ {
"db_name": "PostgreSQL", "db_name": "PostgreSQL",
"query": "\n SELECT\n b.id,\n b.title,\n b.lang,\n b.file_type,\n b.year,\n 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>\",\n b.uploaded,\n (\n SELECT\n JSON_AGG(\n JSON_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM translations\n JOIN authors ON authors.id = translations.author\n WHERE translations.book = b.id\n ) AS \"translators!: Vec<Author>\",\n (\n SELECT\n JSON_AGG(\n JSON_BUILD_OBJECT(\n 'id', sequences.id,\n 'name', sequences.name\n )\n )\n FROM book_sequences\n JOIN sequences ON sequences.id = book_sequences.sequence\n WHERE book_sequences.book = b.id\n ) AS \"sequences!: Vec<Sequence>\",\n EXISTS(\n SELECT * FROM book_annotations WHERE book = b.id\n ) AS \"annotation_exists!: bool\"\n FROM books b\n JOIN book_authors ba ON b.id = ba.book\n WHERE b.is_deleted = false AND ba.author = $1 AND b.lang = ANY($2)\n ORDER BY b.title ASC\n OFFSET $3\n LIMIT $4\n ", "query": "\n SELECT\n b.id,\n b.title,\n b.lang,\n b.file_type,\n b.year,\n 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>\",\n b.uploaded,\n (\n SELECT\n JSONB_AGG(\n JSONB_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM book_authors\n JOIN authors ON authors.id = book_authors.author\n WHERE book_authors.book = b.id\n ) AS \"authors!: Vec<Author>\",\n (\n SELECT\n JSONB_AGG(\n JSONB_BUILD_OBJECT(\n 'id', sequences.id,\n 'name', sequences.name\n )\n )\n FROM book_sequences\n JOIN sequences ON sequences.id = book_sequences.sequence\n WHERE book_sequences.book = b.id\n ) AS \"sequences!: Vec<Sequence>\",\n EXISTS(\n SELECT * FROM book_annotations WHERE book = b.id\n ) AS \"annotation_exists!: bool\"\n FROM books b\n ",
"describe": { "describe": {
"columns": [ "columns": [
{ {
@@ -40,13 +40,13 @@
}, },
{ {
"ordinal": 7, "ordinal": 7,
"name": "translators!: Vec<Author>", "name": "authors!: Vec<Author>",
"type_info": "Json" "type_info": "Jsonb"
}, },
{ {
"ordinal": 8, "ordinal": 8,
"name": "sequences!: Vec<Sequence>", "name": "sequences!: Vec<Sequence>",
"type_info": "Json" "type_info": "Jsonb"
}, },
{ {
"ordinal": 9, "ordinal": 9,
@@ -55,12 +55,7 @@
} }
], ],
"parameters": { "parameters": {
"Left": [ "Left": []
"Int4",
"TextArray",
"Int8",
"Int8"
]
}, },
"nullable": [ "nullable": [
false, false,
@@ -75,5 +70,5 @@
null null
] ]
}, },
"hash": "d6aca7480253eca9b91da9f68aa7156aa3bcf6f8e2d743ea727a2f7abfb69f1b" "hash": "6f91dfb52d18d080bcaf1dfbf7b7d4b6a6168cc33312d767798815d802962ff9"
} }

View File

@@ -1,6 +1,6 @@
{ {
"db_name": "PostgreSQL", "db_name": "PostgreSQL",
"query": "\n SELECT\n genres.id,\n genres.remote_id,\n genres.code,\n genres.description,\n genres.meta,\n (\n SELECT\n JSON_BUILD_OBJECT(\n 'id', sources.id,\n 'name', sources.name\n )\n FROM sources\n WHERE sources.id = genres.source\n ) AS \"source!: Source\"\n FROM genres\n ORDER BY genres.id ASC\n ", "query": "\n SELECT\n genres.id,\n genres.remote_id,\n genres.code,\n genres.description,\n genres.meta,\n (\n SELECT\n JSONB_BUILD_OBJECT(\n 'id', sources.id,\n 'name', sources.name\n )\n FROM sources\n WHERE sources.id = genres.source\n ) AS \"source!: Source\"\n FROM genres\n ORDER BY genres.id ASC\n ",
"describe": { "describe": {
"columns": [ "columns": [
{ {
@@ -31,7 +31,7 @@
{ {
"ordinal": 5, "ordinal": 5,
"name": "source!: Source", "name": "source!: Source",
"type_info": "Json" "type_info": "Jsonb"
} }
], ],
"parameters": { "parameters": {
@@ -46,5 +46,5 @@
null null
] ]
}, },
"hash": "b0ed6a54e198e8388620cc9cf12deed4ce2f7c539c912caa0c6f3b46c8f8835f" "hash": "763625de44f46e1183a1ca2760120ce0303b571ffbc4e5f544340b5134229940"
} }

View File

@@ -0,0 +1,101 @@
{
"db_name": "PostgreSQL",
"query": "\n SELECT\n b.id,\n b.title,\n b.lang,\n b.file_type,\n b.year,\n 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>\",\n b.uploaded,\n (\n SELECT\n JSONB_AGG(\n JSONB_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM book_authors\n JOIN authors ON authors.id = book_authors.author\n WHERE book_authors.book = b.id\n ) AS \"authors!: Vec<Author>\",\n (\n SELECT\n JSONB_AGG(\n JSONB_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM translations\n JOIN authors ON authors.id = translations.author\n WHERE translations.book = b.id\n ) AS \"translators!: Vec<Author>\",\n (\n SELECT\n JSONB_AGG(\n JSONB_BUILD_OBJECT(\n 'id', sequences.id,\n 'name', sequences.name\n )\n )\n FROM book_sequences\n JOIN sequences ON sequences.id = book_sequences.sequence\n WHERE book_sequences.book = b.id\n ) AS \"sequences!: Vec<Sequence>\",\n EXISTS(\n SELECT * FROM book_annotations WHERE book = b.id\n ) AS \"annotation_exists!: bool\",\n (\n SELECT\n JSONB_BUILD_OBJECT(\n 'id', sources.id,\n 'name', sources.name\n )\n FROM sources\n WHERE sources.id = b.source\n ) AS \"source!: Source\",\n b.remote_id\n FROM books b\n WHERE lang = ANY($1) AND\n ($2::boolean IS NULL OR is_deleted = $2) AND\n ($3::date IS NULL OR uploaded >= $3) AND\n ($4::date IS NULL OR uploaded <= $4) AND\n ($5::integer IS NULL OR id >= $5) AND\n ($6::integer IS NULL OR id <= $6)\n ORDER BY b.id ASC\n OFFSET $7\n LIMIT $8\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id",
"type_info": "Int4"
},
{
"ordinal": 1,
"name": "title",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "lang",
"type_info": "Varchar"
},
{
"ordinal": 3,
"name": "file_type",
"type_info": "Varchar"
},
{
"ordinal": 4,
"name": "year",
"type_info": "Int2"
},
{
"ordinal": 5,
"name": "available_types!: Vec<String>",
"type_info": "TextArray"
},
{
"ordinal": 6,
"name": "uploaded",
"type_info": "Date"
},
{
"ordinal": 7,
"name": "authors!: Vec<Author>",
"type_info": "Jsonb"
},
{
"ordinal": 8,
"name": "translators!: Vec<Author>",
"type_info": "Jsonb"
},
{
"ordinal": 9,
"name": "sequences!: Vec<Sequence>",
"type_info": "Jsonb"
},
{
"ordinal": 10,
"name": "annotation_exists!: bool",
"type_info": "Bool"
},
{
"ordinal": 11,
"name": "source!: Source",
"type_info": "Jsonb"
},
{
"ordinal": 12,
"name": "remote_id",
"type_info": "Int4"
}
],
"parameters": {
"Left": [
"TextArray",
"Bool",
"Date",
"Date",
"Int4",
"Int4",
"Int8",
"Int8"
]
},
"nullable": [
false,
false,
false,
false,
false,
null,
false,
null,
null,
null,
null,
null,
false
]
},
"hash": "8050a82de1de70e6ca60a02227795a263774da36fb00b97b00ed4ecd9a7ec778"
}

View File

@@ -1,6 +1,6 @@
{ {
"db_name": "PostgreSQL", "db_name": "PostgreSQL",
"query": "\n SELECT\n genres.id,\n genres.remote_id,\n genres.code,\n genres.description,\n genres.meta,\n (\n SELECT\n JSON_BUILD_OBJECT(\n 'id', sources.id,\n 'name', sources.name\n )\n FROM sources\n WHERE sources.id = genres.source\n ) AS \"source!: Source\"\n FROM genres\n WHERE (meta = $1 OR $1 IS NULL)\n ORDER BY genres.id ASC\n LIMIT $2 OFFSET $3\n ", "query": "\n SELECT\n genres.id,\n genres.remote_id,\n genres.code,\n genres.description,\n genres.meta,\n (\n SELECT\n JSONB_BUILD_OBJECT(\n 'id', sources.id,\n 'name', sources.name\n )\n FROM sources\n WHERE sources.id = genres.source\n ) AS \"source!: Source\"\n FROM genres\n WHERE (meta = $1 OR $1 IS NULL)\n ORDER BY genres.id ASC\n LIMIT $2 OFFSET $3\n ",
"describe": { "describe": {
"columns": [ "columns": [
{ {
@@ -31,7 +31,7 @@
{ {
"ordinal": 5, "ordinal": 5,
"name": "source!: Source", "name": "source!: Source",
"type_info": "Json" "type_info": "Jsonb"
} }
], ],
"parameters": { "parameters": {
@@ -50,5 +50,5 @@
null null
] ]
}, },
"hash": "daada7d7552a41a8d44a4f7b3d62bc804f3f4944166d8e168e1a3a91f2ff4bc9" "hash": "868081a73c2ee8e44db3d19d82afed39949d5310dfccdea2bbda1086f8ff9120"
} }

View File

@@ -0,0 +1,79 @@
{
"db_name": "PostgreSQL",
"query": "\n SELECT\n b.id,\n b.title,\n b.lang,\n b.file_type,\n b.year,\n 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>\",\n b.uploaded,\n (\n SELECT\n JSONB_AGG(\n JSONB_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM translations\n JOIN authors ON authors.id = translations.author\n WHERE translations.book = b.id\n ) AS \"translators!: Vec<Author>\",\n (\n SELECT\n JSONB_AGG(\n JSONB_BUILD_OBJECT(\n 'id', sequences.id,\n 'name', sequences.name\n )\n )\n FROM book_sequences\n JOIN sequences ON sequences.id = book_sequences.sequence\n WHERE book_sequences.book = b.id\n ) AS \"sequences!: Vec<Sequence>\",\n EXISTS(\n SELECT * FROM book_annotations WHERE book = b.id\n ) AS \"annotation_exists!: bool\"\n FROM books b\n JOIN book_authors ba ON b.id = ba.book\n WHERE b.is_deleted = false AND ba.author = $1 AND b.lang = ANY($2)\n ORDER BY b.title ASC\n OFFSET $3\n LIMIT $4\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id",
"type_info": "Int4"
},
{
"ordinal": 1,
"name": "title",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "lang",
"type_info": "Varchar"
},
{
"ordinal": 3,
"name": "file_type",
"type_info": "Varchar"
},
{
"ordinal": 4,
"name": "year",
"type_info": "Int2"
},
{
"ordinal": 5,
"name": "available_types!: Vec<String>",
"type_info": "TextArray"
},
{
"ordinal": 6,
"name": "uploaded",
"type_info": "Date"
},
{
"ordinal": 7,
"name": "translators!: Vec<Author>",
"type_info": "Jsonb"
},
{
"ordinal": 8,
"name": "sequences!: Vec<Sequence>",
"type_info": "Jsonb"
},
{
"ordinal": 9,
"name": "annotation_exists!: bool",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"Int4",
"TextArray",
"Int8",
"Int8"
]
},
"nullable": [
false,
false,
false,
false,
false,
null,
false,
null,
null,
null
]
},
"hash": "91845687097ff0ce0f2f1dd51d2b61d2abf1cd2f04c2b3371f32720501c5f790"
}

View File

@@ -1,74 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n SELECT\n b.id,\n b.title,\n b.lang,\n b.file_type,\n b.year,\n 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>\",\n b.uploaded,\n (\n SELECT\n JSON_AGG(\n JSON_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM book_authors\n JOIN authors ON authors.id = book_authors.author\n WHERE book_authors.book = b.id\n ) AS \"authors!: Vec<Author>\",\n (\n SELECT\n JSON_AGG(\n JSON_BUILD_OBJECT(\n 'id', sequences.id,\n 'name', sequences.name\n )\n )\n FROM book_sequences\n JOIN sequences ON sequences.id = book_sequences.sequence\n WHERE book_sequences.book = b.id\n ) AS \"sequences!: Vec<Sequence>\",\n EXISTS(\n SELECT * FROM book_annotations WHERE book = b.id\n ) AS \"annotation_exists!: bool\"\n FROM books b\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id",
"type_info": "Int4"
},
{
"ordinal": 1,
"name": "title",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "lang",
"type_info": "Varchar"
},
{
"ordinal": 3,
"name": "file_type",
"type_info": "Varchar"
},
{
"ordinal": 4,
"name": "year",
"type_info": "Int2"
},
{
"ordinal": 5,
"name": "available_types!: Vec<String>",
"type_info": "TextArray"
},
{
"ordinal": 6,
"name": "uploaded",
"type_info": "Date"
},
{
"ordinal": 7,
"name": "authors!: Vec<Author>",
"type_info": "Json"
},
{
"ordinal": 8,
"name": "sequences!: Vec<Sequence>",
"type_info": "Json"
},
{
"ordinal": 9,
"name": "annotation_exists!: bool",
"type_info": "Bool"
}
],
"parameters": {
"Left": []
},
"nullable": [
false,
false,
false,
false,
false,
null,
false,
null,
null,
null
]
},
"hash": "92f7e43d41bb56fe9ef3207ff4f870e12a02347d479dcda39c72f0ff2fe6a6fd"
}

View File

@@ -0,0 +1,82 @@
{
"db_name": "PostgreSQL",
"query": "\n SELECT\n b.id,\n b.title,\n b.lang,\n b.file_type,\n b.year,\n 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>\",\n b.uploaded,\n (\n SELECT\n JSONB_AGG(\n JSONB_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM book_authors\n JOIN authors ON authors.id = book_authors.author\n WHERE book_authors.book = b.id\n ) AS \"authors!: Vec<Author>\",\n (\n SELECT\n JSONB_AGG(\n JSONB_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM translations\n JOIN authors ON authors.id = translations.author\n WHERE translations.book = b.id\n ) AS \"translators!: Vec<Author>\",\n (\n SELECT\n JSONB_AGG(\n JSONB_BUILD_OBJECT(\n 'id', sequences.id,\n 'name', sequences.name\n )\n )\n FROM book_sequences\n JOIN sequences ON sequences.id = book_sequences.sequence\n WHERE book_sequences.book = b.id\n ) AS \"sequences!: Vec<Sequence>\",\n EXISTS(\n SELECT * FROM book_annotations WHERE book = b.id\n ) AS \"annotation_exists!: bool\"\n FROM books b\n WHERE b.id = ANY($1)\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id",
"type_info": "Int4"
},
{
"ordinal": 1,
"name": "title",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "lang",
"type_info": "Varchar"
},
{
"ordinal": 3,
"name": "file_type",
"type_info": "Varchar"
},
{
"ordinal": 4,
"name": "year",
"type_info": "Int2"
},
{
"ordinal": 5,
"name": "available_types!: Vec<String>",
"type_info": "TextArray"
},
{
"ordinal": 6,
"name": "uploaded",
"type_info": "Date"
},
{
"ordinal": 7,
"name": "authors!: Vec<Author>",
"type_info": "Jsonb"
},
{
"ordinal": 8,
"name": "translators!: Vec<Author>",
"type_info": "Jsonb"
},
{
"ordinal": 9,
"name": "sequences!: Vec<Sequence>",
"type_info": "Jsonb"
},
{
"ordinal": 10,
"name": "annotation_exists!: bool",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"Int4Array"
]
},
"nullable": [
false,
false,
false,
false,
false,
null,
false,
null,
null,
null,
null
]
},
"hash": "c270823ac20835ebeba0fca557c8bb237bf9f4fa7c5b1956e2cf491b01ae30b0"
}

View File

@@ -1,82 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n SELECT\n b.id,\n b.title,\n b.lang,\n b.file_type,\n b.year,\n 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>\",\n b.uploaded,\n (\n SELECT\n JSON_AGG(\n JSON_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM book_authors\n JOIN authors ON authors.id = book_authors.author\n WHERE book_authors.book = b.id\n ) AS \"authors!: Vec<Author>\",\n (\n SELECT\n JSON_AGG(\n JSON_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM translations\n JOIN authors ON authors.id = translations.author\n WHERE translations.book = b.id\n ) AS \"translators!: Vec<Author>\",\n (\n SELECT\n JSON_AGG(\n JSON_BUILD_OBJECT(\n 'id', sequences.id,\n 'name', sequences.name\n )\n )\n FROM book_sequences\n JOIN sequences ON sequences.id = book_sequences.sequence\n WHERE book_sequences.book = b.id\n ) AS \"sequences!: Vec<Sequence>\",\n EXISTS(\n SELECT * FROM book_annotations WHERE book = b.id\n ) AS \"annotation_exists!: bool\"\n FROM books b\n WHERE b.id = ANY($1)\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id",
"type_info": "Int4"
},
{
"ordinal": 1,
"name": "title",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "lang",
"type_info": "Varchar"
},
{
"ordinal": 3,
"name": "file_type",
"type_info": "Varchar"
},
{
"ordinal": 4,
"name": "year",
"type_info": "Int2"
},
{
"ordinal": 5,
"name": "available_types!: Vec<String>",
"type_info": "TextArray"
},
{
"ordinal": 6,
"name": "uploaded",
"type_info": "Date"
},
{
"ordinal": 7,
"name": "authors!: Vec<Author>",
"type_info": "Json"
},
{
"ordinal": 8,
"name": "translators!: Vec<Author>",
"type_info": "Json"
},
{
"ordinal": 9,
"name": "sequences!: Vec<Sequence>",
"type_info": "Json"
},
{
"ordinal": 10,
"name": "annotation_exists!: bool",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"Int4Array"
]
},
"nullable": [
false,
false,
false,
false,
false,
null,
false,
null,
null,
null,
null
]
},
"hash": "cedb65e8561dfff84cfab1eac28e03f082ea8190a47283fb6662e2d9a6246c57"
}

View File

@@ -1,113 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n SELECT\n b.id,\n b.title,\n b.lang,\n b.file_type,\n b.year,\n 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>\",\n b.uploaded,\n (\n SELECT\n JSON_AGG(\n JSON_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM book_authors\n JOIN authors ON authors.id = book_authors.author\n WHERE book_authors.book = b.id\n ) AS \"authors!: Vec<Author>\",\n (\n SELECT\n JSON_AGG(\n JSON_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM translations\n JOIN authors ON authors.id = translations.author\n WHERE translations.book = b.id\n ) AS \"translators!: Vec<Author>\",\n (\n SELECT\n JSON_AGG(\n JSON_BUILD_OBJECT(\n 'id', sequences.id,\n 'name', sequences.name\n )\n )\n FROM book_sequences\n JOIN sequences ON sequences.id = book_sequences.sequence\n WHERE book_sequences.book = b.id\n ) AS \"sequences!: Vec<Sequence>\",\n (\n SELECT\n JSON_AGG(\n JSON_BUILD_OBJECT(\n 'id', genres.id,\n 'code', genres.code,\n 'description', genres.description,\n 'meta', genres.meta,\n 'source', JSON_BUILD_OBJECT(\n 'id', sources.id,\n 'name', sources.name\n )\n )\n )\n FROM book_genres\n JOIN genres ON genres.id = book_genres.genre\n JOIN sources ON sources.id = genres.source\n WHERE book_genres.book = b.id\n ) AS \"genres!: Vec<Genre>\",\n EXISTS(\n SELECT * FROM book_annotations WHERE book = b.id\n ) AS \"annotation_exists!: bool\",\n (\n SELECT\n JSON_BUILD_OBJECT(\n 'id', sources.id,\n 'name', sources.name\n )\n FROM sources\n WHERE sources.id = b.source\n ) AS \"source!: Source\",\n b.remote_id,\n b.is_deleted,\n b.pages\n FROM books b\n WHERE b.source = $1 AND b.remote_id = $2\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id",
"type_info": "Int4"
},
{
"ordinal": 1,
"name": "title",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "lang",
"type_info": "Varchar"
},
{
"ordinal": 3,
"name": "file_type",
"type_info": "Varchar"
},
{
"ordinal": 4,
"name": "year",
"type_info": "Int2"
},
{
"ordinal": 5,
"name": "available_types!: Vec<String>",
"type_info": "TextArray"
},
{
"ordinal": 6,
"name": "uploaded",
"type_info": "Date"
},
{
"ordinal": 7,
"name": "authors!: Vec<Author>",
"type_info": "Json"
},
{
"ordinal": 8,
"name": "translators!: Vec<Author>",
"type_info": "Json"
},
{
"ordinal": 9,
"name": "sequences!: Vec<Sequence>",
"type_info": "Json"
},
{
"ordinal": 10,
"name": "genres!: Vec<Genre>",
"type_info": "Json"
},
{
"ordinal": 11,
"name": "annotation_exists!: bool",
"type_info": "Bool"
},
{
"ordinal": 12,
"name": "source!: Source",
"type_info": "Json"
},
{
"ordinal": 13,
"name": "remote_id",
"type_info": "Int4"
},
{
"ordinal": 14,
"name": "is_deleted",
"type_info": "Bool"
},
{
"ordinal": 15,
"name": "pages",
"type_info": "Int4"
}
],
"parameters": {
"Left": [
"Int2",
"Int4"
]
},
"nullable": [
false,
false,
false,
false,
false,
null,
false,
null,
null,
null,
null,
null,
null,
false,
false,
true
]
},
"hash": "df08b13f0f084e01ce2e5d9e31ed1dc0e7499483f1bbcdafc2b85c5ad0e3b956"
}

View File

@@ -0,0 +1,113 @@
{
"db_name": "PostgreSQL",
"query": "\n SELECT\n b.id,\n b.title,\n b.lang,\n b.file_type,\n b.year,\n 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>\",\n b.uploaded,\n (\n SELECT\n JSONB_AGG(\n JSONB_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM book_authors\n JOIN authors ON authors.id = book_authors.author\n WHERE book_authors.book = b.id\n ) AS \"authors!: Vec<Author>\",\n (\n SELECT\n JSONB_AGG(\n JSONB_BUILD_OBJECT(\n 'id', authors.id,\n 'first_name', authors.first_name,\n 'last_name', authors.last_name,\n 'middle_name', authors.middle_name,\n 'annotation_exists', EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )\n )\n FROM translations\n JOIN authors ON authors.id = translations.author\n WHERE translations.book = b.id\n ) AS \"translators!: Vec<Author>\",\n (\n SELECT\n JSONB_AGG(\n JSONB_BUILD_OBJECT(\n 'id', sequences.id,\n 'name', sequences.name\n )\n )\n FROM book_sequences\n JOIN sequences ON sequences.id = book_sequences.sequence\n WHERE book_sequences.book = b.id\n ) AS \"sequences!: Vec<Sequence>\",\n (\n SELECT\n JSONB_AGG(\n JSONB_BUILD_OBJECT(\n 'id', genres.id,\n 'code', genres.code,\n 'description', genres.description,\n 'meta', genres.meta,\n 'source', JSONB_BUILD_OBJECT(\n 'id', sources.id,\n 'name', sources.name\n )\n )\n )\n FROM book_genres\n JOIN genres ON genres.id = book_genres.genre\n JOIN sources ON sources.id = genres.source\n WHERE book_genres.book = b.id\n ) AS \"genres!: Vec<Genre>\",\n EXISTS(\n SELECT * FROM book_annotations WHERE book = b.id\n ) AS \"annotation_exists!: bool\",\n (\n SELECT\n JSONB_BUILD_OBJECT(\n 'id', sources.id,\n 'name', sources.name\n )\n FROM sources\n WHERE sources.id = b.source\n ) AS \"source!: Source\",\n b.remote_id,\n b.is_deleted,\n b.pages\n FROM books b\n WHERE b.source = $1 AND b.remote_id = $2\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id",
"type_info": "Int4"
},
{
"ordinal": 1,
"name": "title",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "lang",
"type_info": "Varchar"
},
{
"ordinal": 3,
"name": "file_type",
"type_info": "Varchar"
},
{
"ordinal": 4,
"name": "year",
"type_info": "Int2"
},
{
"ordinal": 5,
"name": "available_types!: Vec<String>",
"type_info": "TextArray"
},
{
"ordinal": 6,
"name": "uploaded",
"type_info": "Date"
},
{
"ordinal": 7,
"name": "authors!: Vec<Author>",
"type_info": "Jsonb"
},
{
"ordinal": 8,
"name": "translators!: Vec<Author>",
"type_info": "Jsonb"
},
{
"ordinal": 9,
"name": "sequences!: Vec<Sequence>",
"type_info": "Jsonb"
},
{
"ordinal": 10,
"name": "genres!: Vec<Genre>",
"type_info": "Jsonb"
},
{
"ordinal": 11,
"name": "annotation_exists!: bool",
"type_info": "Bool"
},
{
"ordinal": 12,
"name": "source!: Source",
"type_info": "Jsonb"
},
{
"ordinal": 13,
"name": "remote_id",
"type_info": "Int4"
},
{
"ordinal": 14,
"name": "is_deleted",
"type_info": "Bool"
},
{
"ordinal": 15,
"name": "pages",
"type_info": "Int4"
}
],
"parameters": {
"Left": [
"Int2",
"Int4"
]
},
"nullable": [
false,
false,
false,
false,
false,
null,
false,
null,
null,
null,
null,
null,
null,
false,
false,
true
]
},
"hash": "e6cf55988b86d72c594915c9e5a015d71106794415fb267d6f71d512e9831012"
}

View File

@@ -23,7 +23,7 @@ pub struct AuthorBook {
pub available_types: Vec<String>, pub available_types: Vec<String>,
#[serde(serialize_with = "naive_date_serializer::serialize")] #[serde(serialize_with = "naive_date_serializer::serialize")]
pub uploaded: NaiveDate, pub uploaded: NaiveDate,
pub translators: Vec<Author>, pub translators: sqlx::types::Json<Vec<Author>>,
pub sequences: Vec<Sequence>, pub sequences: sqlx::types::Json<Vec<Sequence>>,
pub annotation_exists: bool, pub annotation_exists: bool,
} }

View File

@@ -81,8 +81,8 @@ pub struct Book {
pub available_types: Vec<String>, pub available_types: Vec<String>,
#[serde(serialize_with = "naive_date_serializer::serialize")] #[serde(serialize_with = "naive_date_serializer::serialize")]
pub uploaded: NaiveDate, pub uploaded: NaiveDate,
pub authors: Vec<Author>, pub authors: sqlx::types::Json<Vec<Author>>,
pub translators: Vec<Author>, pub translators: sqlx::types::Json<Vec<Author>>,
pub sequences: Vec<Sequence>, pub sequences: sqlx::types::Json<Vec<Sequence>>,
pub annotation_exists: bool, pub annotation_exists: bool,
} }

View File

@@ -20,8 +20,8 @@ pub struct SequenceBook {
pub available_types: Vec<String>, pub available_types: Vec<String>,
#[serde(serialize_with = "naive_date_serializer::serialize")] #[serde(serialize_with = "naive_date_serializer::serialize")]
pub uploaded: NaiveDate, pub uploaded: NaiveDate,
pub authors: Vec<Author>, pub authors: sqlx::types::Json<Vec<Author>>,
pub translators: Vec<Author>, pub translators: sqlx::types::Json<Vec<Author>>,
pub annotation_exists: bool, pub annotation_exists: bool,
pub position: i32, pub position: i32,
} }

View File

@@ -15,7 +15,7 @@ pub struct TranslatorBook {
pub available_types: Vec<String>, pub available_types: Vec<String>,
#[serde(serialize_with = "naive_date_serializer::serialize")] #[serde(serialize_with = "naive_date_serializer::serialize")]
pub uploaded: NaiveDate, pub uploaded: NaiveDate,
pub authors: Vec<Author>, pub authors: sqlx::types::Json<Vec<Author>>,
pub sequences: Vec<Sequence>, pub sequences: sqlx::types::Json<Vec<Sequence>>,
pub annotation_exists: bool, pub annotation_exists: bool,
} }

View File

@@ -216,8 +216,8 @@ async fn get_author_books(
b.uploaded, b.uploaded,
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', authors.id, 'id', authors.id,
'first_name', authors.first_name, 'first_name', authors.first_name,
'last_name', authors.last_name, 'last_name', authors.last_name,
@@ -233,8 +233,8 @@ async fn get_author_books(
) AS "translators!: Vec<Author>", ) AS "translators!: Vec<Author>",
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', sequences.id, 'id', sequences.id,
'name', sequences.name 'name', sequences.name
) )

View File

@@ -62,8 +62,8 @@ pub async fn get_books(
b.uploaded, b.uploaded,
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', authors.id, 'id', authors.id,
'first_name', authors.first_name, 'first_name', authors.first_name,
'last_name', authors.last_name, 'last_name', authors.last_name,
@@ -79,8 +79,8 @@ pub async fn get_books(
) AS "authors!: Vec<Author>", ) AS "authors!: Vec<Author>",
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', authors.id, 'id', authors.id,
'first_name', authors.first_name, 'first_name', authors.first_name,
'last_name', authors.last_name, 'last_name', authors.last_name,
@@ -96,8 +96,8 @@ pub async fn get_books(
) AS "translators!: Vec<Author>", ) AS "translators!: Vec<Author>",
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', sequences.id, 'id', sequences.id,
'name', sequences.name 'name', sequences.name
) )
@@ -111,7 +111,7 @@ pub async fn get_books(
) AS "annotation_exists!: bool", ) AS "annotation_exists!: bool",
( (
SELECT SELECT
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', sources.id, 'id', sources.id,
'name', sources.name 'name', sources.name
) )
@@ -245,8 +245,8 @@ pub async fn get_random_book(
b.uploaded, b.uploaded,
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', authors.id, 'id', authors.id,
'first_name', authors.first_name, 'first_name', authors.first_name,
'last_name', authors.last_name, 'last_name', authors.last_name,
@@ -262,8 +262,8 @@ pub async fn get_random_book(
) AS "authors!: Vec<Author>", ) AS "authors!: Vec<Author>",
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', authors.id, 'id', authors.id,
'first_name', authors.first_name, 'first_name', authors.first_name,
'last_name', authors.last_name, 'last_name', authors.last_name,
@@ -279,8 +279,8 @@ pub async fn get_random_book(
) AS "translators!: Vec<Author>", ) AS "translators!: Vec<Author>",
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', sequences.id, 'id', sequences.id,
'name', sequences.name 'name', sequences.name
) )
@@ -291,13 +291,13 @@ pub async fn get_random_book(
) AS "sequences!: Vec<Sequence>", ) AS "sequences!: Vec<Sequence>",
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', genres.id, 'id', genres.id,
'code', genres.code, 'code', genres.code,
'description', genres.description, 'description', genres.description,
'meta', genres.meta, 'meta', genres.meta,
'source', JSON_BUILD_OBJECT( 'source', JSONB_BUILD_OBJECT(
'id', sources.id, 'id', sources.id,
'name', sources.name 'name', sources.name
) )
@@ -313,7 +313,7 @@ pub async fn get_random_book(
) AS "annotation_exists!: bool", ) AS "annotation_exists!: bool",
( (
SELECT SELECT
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', sources.id, 'id', sources.id,
'name', sources.name 'name', sources.name
) )
@@ -353,8 +353,8 @@ pub async fn get_remote_book(
b.uploaded, b.uploaded,
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', authors.id, 'id', authors.id,
'first_name', authors.first_name, 'first_name', authors.first_name,
'last_name', authors.last_name, 'last_name', authors.last_name,
@@ -370,8 +370,8 @@ pub async fn get_remote_book(
) AS "authors!: Vec<Author>", ) AS "authors!: Vec<Author>",
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', authors.id, 'id', authors.id,
'first_name', authors.first_name, 'first_name', authors.first_name,
'last_name', authors.last_name, 'last_name', authors.last_name,
@@ -387,8 +387,8 @@ pub async fn get_remote_book(
) AS "translators!: Vec<Author>", ) AS "translators!: Vec<Author>",
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', sequences.id, 'id', sequences.id,
'name', sequences.name 'name', sequences.name
) )
@@ -399,13 +399,13 @@ pub async fn get_remote_book(
) AS "sequences!: Vec<Sequence>", ) AS "sequences!: Vec<Sequence>",
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', genres.id, 'id', genres.id,
'code', genres.code, 'code', genres.code,
'description', genres.description, 'description', genres.description,
'meta', genres.meta, 'meta', genres.meta,
'source', JSON_BUILD_OBJECT( 'source', JSONB_BUILD_OBJECT(
'id', sources.id, 'id', sources.id,
'name', sources.name 'name', sources.name
) )
@@ -421,7 +421,7 @@ pub async fn get_remote_book(
) AS "annotation_exists!: bool", ) AS "annotation_exists!: bool",
( (
SELECT SELECT
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', sources.id, 'id', sources.id,
'name', sources.name 'name', sources.name
) )
@@ -491,8 +491,8 @@ pub async fn search_books(
b.uploaded, b.uploaded,
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', authors.id, 'id', authors.id,
'first_name', authors.first_name, 'first_name', authors.first_name,
'last_name', authors.last_name, 'last_name', authors.last_name,
@@ -508,8 +508,8 @@ pub async fn search_books(
) AS "authors!: Vec<Author>", ) AS "authors!: Vec<Author>",
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', authors.id, 'id', authors.id,
'first_name', authors.first_name, 'first_name', authors.first_name,
'last_name', authors.last_name, 'last_name', authors.last_name,
@@ -525,8 +525,8 @@ pub async fn search_books(
) AS "translators!: Vec<Author>", ) AS "translators!: Vec<Author>",
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', sequences.id, 'id', sequences.id,
'name', sequences.name 'name', sequences.name
) )
@@ -573,8 +573,8 @@ pub async fn get_book(db: Database, Path(book_id): Path<i32>) -> impl IntoRespon
b.uploaded, b.uploaded,
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', authors.id, 'id', authors.id,
'first_name', authors.first_name, 'first_name', authors.first_name,
'last_name', authors.last_name, 'last_name', authors.last_name,
@@ -590,8 +590,8 @@ pub async fn get_book(db: Database, Path(book_id): Path<i32>) -> impl IntoRespon
) AS "authors!: Vec<Author>", ) AS "authors!: Vec<Author>",
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', authors.id, 'id', authors.id,
'first_name', authors.first_name, 'first_name', authors.first_name,
'last_name', authors.last_name, 'last_name', authors.last_name,
@@ -607,8 +607,8 @@ pub async fn get_book(db: Database, Path(book_id): Path<i32>) -> impl IntoRespon
) AS "translators!: Vec<Author>", ) AS "translators!: Vec<Author>",
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', sequences.id, 'id', sequences.id,
'name', sequences.name 'name', sequences.name
) )
@@ -619,13 +619,13 @@ pub async fn get_book(db: Database, Path(book_id): Path<i32>) -> impl IntoRespon
) AS "sequences!: Vec<Sequence>", ) AS "sequences!: Vec<Sequence>",
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', genres.id, 'id', genres.id,
'code', genres.code, 'code', genres.code,
'description', genres.description, 'description', genres.description,
'meta', genres.meta, 'meta', genres.meta,
'source', JSON_BUILD_OBJECT( 'source', JSONB_BUILD_OBJECT(
'id', sources.id, 'id', sources.id,
'name', sources.name 'name', sources.name
) )
@@ -641,7 +641,7 @@ pub async fn get_book(db: Database, Path(book_id): Path<i32>) -> impl IntoRespon
) AS "annotation_exists!: bool", ) AS "annotation_exists!: bool",
( (
SELECT SELECT
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', sources.id, 'id', sources.id,
'name', sources.name 'name', sources.name
) )

View File

@@ -39,7 +39,7 @@ pub async fn get_genres(
genres.meta, genres.meta,
( (
SELECT SELECT
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', sources.id, 'id', sources.id,
'name', sources.name 'name', sources.name
) )
@@ -76,7 +76,7 @@ pub async fn get_genre_metas(db: Database) -> impl IntoResponse {
genres.meta, genres.meta,
( (
SELECT SELECT
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', sources.id, 'id', sources.id,
'name', sources.name 'name', sources.name
) )

View File

@@ -215,8 +215,8 @@ async fn get_sequence_books(
b.uploaded, b.uploaded,
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', authors.id, 'id', authors.id,
'first_name', authors.first_name, 'first_name', authors.first_name,
'last_name', authors.last_name, 'last_name', authors.last_name,
@@ -232,8 +232,8 @@ async fn get_sequence_books(
) AS "authors!: Vec<Author>", ) AS "authors!: Vec<Author>",
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', authors.id, 'id', authors.id,
'first_name', authors.first_name, 'first_name', authors.first_name,
'last_name', authors.last_name, 'last_name', authors.last_name,

View File

@@ -88,8 +88,8 @@ async fn get_translated_books(
b.uploaded, b.uploaded,
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', authors.id, 'id', authors.id,
'first_name', authors.first_name, 'first_name', authors.first_name,
'last_name', authors.last_name, 'last_name', authors.last_name,
@@ -105,8 +105,8 @@ async fn get_translated_books(
) AS "authors!: Vec<Author>", ) AS "authors!: Vec<Author>",
( (
SELECT SELECT
JSON_AGG( JSONB_AGG(
JSON_BUILD_OBJECT( JSONB_BUILD_OBJECT(
'id', sequences.id, 'id', sequences.id,
'name', sequences.name 'name', sequences.name
) )