diff options
| author | Kana <[email protected]> | 2021-01-09 00:53:16 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-01-09 00:53:16 +0900 |
| commit | 01e17ed856c4bf095ca53e899e21c192dad01318 (patch) | |
| tree | 65dffc52d24192ffb2a0b4585bda2e7bc235b73c /src/api | |
| parent | feat: use LIKE on queries for case sensitivity issues (diff) | |
| parent | fix: pagination not working when searching (diff) | |
| download | host.fuwn.me-01e17ed856c4bf095ca53e899e21c192dad01318.tar.xz host.fuwn.me-01e17ed856c4bf095ca53e899e21c192dad01318.zip | |
Merge pull request #251 from Zephyrrus/fix/paginate_search
fix: pagination not working when searching & fix: search not working on albums
Diffstat (limited to 'src/api')
| -rw-r--r-- | src/api/routes/search/searchGET.js | 8 | ||||
| -rw-r--r-- | src/api/routes/service/statsGET.js | 4 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/api/routes/search/searchGET.js b/src/api/routes/search/searchGET.js index eaad946..187fcab 100644 --- a/src/api/routes/search/searchGET.js +++ b/src/api/routes/search/searchGET.js @@ -20,7 +20,7 @@ class configGET extends Route { async run(req, res, db, user) { let count = 0; - const { q } = req.query; + const { q, albumId } = req.query; const parsed = searchQuery.parse(q, options); let files = db.table('files') @@ -28,6 +28,12 @@ class configGET extends Route { .where({ 'files.userId': user.id }) .orderBy('files.createdAt', 'desc'); + if (albumId) { + files + .join('albumsFiles', 'albumsFiles.fileId', 'files.id') + .where({ albumId }); + } + files = queryHelper.processQuery(db, files, parsed); // const query = files.toString(); diff --git a/src/api/routes/service/statsGET.js b/src/api/routes/service/statsGET.js index 6d5197b..bcddc9f 100644 --- a/src/api/routes/service/statsGET.js +++ b/src/api/routes/service/statsGET.js @@ -17,8 +17,8 @@ class filesGET extends Route { [category]: { ...dbRes, meta: { - cached: true, - generatedOn: moment().format('MMMM Do YYYY, h:mm:ss a z'), // pg returns this as a date, sqlite3 returns an unix timestamp :< + cached: false, + generatedOn: moment().format('MMMM Do YYYY, h:mm:ss a z'), type: StatsGenerator.Type.HIDDEN } } |