Добавлена возможность отображения всех книг серии

This commit is contained in:
Book Pauk
2022-10-10 22:03:59 +07:00
parent 09b7c38348
commit 58f2483b97
5 changed files with 113 additions and 54 deletions

View File

@@ -153,10 +153,10 @@ class WebSocketController {
}
async getSeriesBookList(req, ws) {
if (!utils.hasProp(req, 'seriesId'))
throw new Error(`seriesId is empty`);
if (!utils.hasProp(req, 'series'))
throw new Error(`series is empty`);
const result = await this.webWorker.getSeriesBookList(req.seriesId);
const result = await this.webWorker.getSeriesBookList(req.series);
this.send(result, req, ws);
}

View File

@@ -292,7 +292,7 @@ class DbSearcher {
}
}
async getSeriesBookList(seriesId) {
async getSeriesBookList(series) {
if (this.closed)
throw new Error('DbSearcher closed');
@@ -301,10 +301,11 @@ class DbSearcher {
try {
const db = this.db;
//выборка серии по seriesId
series = series.toLowerCase();
//выборка серии по названию серии
const rows = await db.select({
table: 'series',
where: `@@id(${db.esc(seriesId)})`
where: `@@dirtyIndexLR('value', ${db.esc(series)}, ${db.esc(series)})`
});
return {books: (rows.length ? rows[0].books : '')};