From 0484ea74a2a69d43de145334a8a73c5555aad72d Mon Sep 17 00:00:00 2001 From: Pitu Date: Fri, 8 Jan 2021 23:47:18 +0900 Subject: fix: prevent db from committing suicide --- src/api/utils/QueryHelper.js | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/api/utils/QueryHelper.js') 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); -- cgit v1.2.3