Добавлен titleSearch

This commit is contained in:
Book Pauk
2022-10-26 17:50:48 +07:00
parent 20bb9f925a
commit 491c2f3406
4 changed files with 120 additions and 0 deletions

View File

@@ -78,6 +78,8 @@ class WebSocketController {
await this.authorSearch(req, ws); break;
case 'series-search':
await this.seriesSearch(req, ws); break;
case 'title-search':
await this.titleSearch(req, ws); break;
case 'get-author-book-list':
await this.getAuthorBookList(req, ws); break;
case 'get-series-book-list':
@@ -156,6 +158,18 @@ class WebSocketController {
this.send(result, req, ws);
}
async titleSearch(req, ws) {
if (!this.config.extendedSearch)
throw new Error(`Extended search disabled`);
if (!req.query)
throw new Error(`query is empty`);
const result = await this.webWorker.titleSearch(req.query);
this.send(result, req, ws);
}
async getAuthorBookList(req, ws) {
const result = await this.webWorker.getAuthorBookList(req.authorId);