aboutsummaryrefslogtreecommitdiff
path: root/src/api/utils/QueryHelper.js
diff options
context:
space:
mode:
authorPitu <[email protected]>2021-01-08 23:47:18 +0900
committerPitu <[email protected]>2021-01-08 23:47:18 +0900
commit0484ea74a2a69d43de145334a8a73c5555aad72d (patch)
tree2eeb0d94efa4aa903dc4bde4aed80988c692b528 /src/api/utils/QueryHelper.js
parentchore: be able to refresh stats on demand (diff)
downloadhost.fuwn.me-0484ea74a2a69d43de145334a8a73c5555aad72d.tar.xz
host.fuwn.me-0484ea74a2a69d43de145334a8a73c5555aad72d.zip
fix: prevent db from committing suicide
Diffstat (limited to 'src/api/utils/QueryHelper.js')
-rw-r--r--src/api/utils/QueryHelper.js4
1 files changed, 0 insertions, 4 deletions
diff --git a/src/api/utils/QueryHelper.js b/src/api/utils/QueryHelper.js
index c26c8eb..d9f253a 100644
--- a/src/api/utils/QueryHelper.js
+++ b/src/api/utils/QueryHelper.js
@@ -104,7 +104,6 @@ class QueryHelper {
const subQ = db.table('fileTags')
.select('fileTags.fileId')
.join('tags', 'fileTags.tagId', '=', 'tags.id')
- .where('fileTags.fileId', db.ref('files.id'))
.whereIn('tags.name', list)
.groupBy('fileTags.fileId')
.havingRaw('count(distinct tags.name) = ?', [list.length]);
@@ -116,7 +115,6 @@ class QueryHelper {
const subQ = db.table('albumsFiles')
.select('albumsFiles.fileId')
.join('albums', 'albumsFiles.albumId', '=', 'albums.id')
- .where('albumsFiles.fileId', db.ref('files.id'))
.whereIn('albums.name', list)
.groupBy('albumsFiles.fileId')
.havingRaw('count(distinct albums.name) = ?', [list.length]);
@@ -128,7 +126,6 @@ class QueryHelper {
const subQ = db.table('fileTags')
.select('fileTags.fileId')
.join('tags', 'fileTags.tagId', '=', 'tags.id')
- .where('fileTags.fileId', db.ref('files.id'))
.whereIn('tags.name', list);
return knex.whereNotIn('files.id', subQ);
@@ -138,7 +135,6 @@ class QueryHelper {
const subQ = db.table('albumsFiles')
.select('albumsFiles.fileId')
.join('albums', 'albumsFiles.albumId', '=', 'albums.id')
- .where('albumsFiles.fileId', db.ref('files.id'))
.whereIn('albums.name', list);
return knex.whereNotIn('files.id', subQ);