Работа над разделом "Серии"

This commit is contained in:
Book Pauk
2022-10-25 19:48:20 +07:00
parent 3a8fa12894
commit cc5d5167a3
8 changed files with 182 additions and 143 deletions

View File

@@ -163,7 +163,7 @@ class WebSocketController {
}
async getSeriesBookList(req, ws) {
const result = await this.webWorker.getSeriesBookList(req.series, req.seriesId);
const result = await this.webWorker.getSeriesBookList(req.series);
this.send(result, req, ws);
}

View File

@@ -483,11 +483,11 @@ class DbSearcher {
}
}
async getSeriesBookList(series, seriesId) {
async getSeriesBookList(series) {
if (this.closed)
throw new Error('DbSearcher closed');
if (!series && !seriesId)
if (!series)
return {books: ''};
this.searchFlag++;
@@ -500,15 +500,16 @@ class DbSearcher {
//выборка серии по названию серии
let rows = await db.select({
table: 'series',
where: `@@dirtyIndexLR('value', ${db.esc(series)}, ${db.esc(series)})`
rawResult: true,
where: `return Array.from(@dirtyIndexLR('value', ${db.esc(series)}, ${db.esc(series)}))`
});
let books;
if (rows.length) {
if (rows.length && rows[0].rawResult.length) {
//выборка книг серии
rows = await db.select({
table: 'series_book',
where: `@@id(${rows[0].id})`
where: `@@id(${rows[0].rawResult[0]})`
});
if (rows.length)

View File

@@ -277,10 +277,10 @@ class WebWorker {
return await this.dbSearcher.getAuthorBookList(authorId);
}
async getSeriesBookList(series, seriesId) {
async getSeriesBookList(series) {
this.checkMyState();
return await this.dbSearcher.getSeriesBookList(series, seriesId);
return await this.dbSearcher.getSeriesBookList(series);
}
async getGenreTree() {