aboutsummaryrefslogtreecommitdiff
path: root/src/api/routes/admin/fileGET.js
diff options
context:
space:
mode:
authorKana <[email protected]>2020-12-24 21:41:24 +0900
committerGitHub <[email protected]>2020-12-24 21:41:24 +0900
commit2412a60bd4cb2364a477a3af79a8c6dcb6b0ddab (patch)
treedbf2b2cad342f31849a62089dedd40165758af86 /src/api/routes/admin/fileGET.js
parentEnable deleting files with the API key (diff)
parentbug: fix showlist resetting itself every time the page is changed (diff)
downloadhost.fuwn.me-2412a60bd4cb2364a477a3af79a8c6dcb6b0ddab.tar.xz
host.fuwn.me-2412a60bd4cb2364a477a3af79a8c6dcb6b0ddab.zip
Merge pull request #228 from Zephyrrus/begone_trailing_commas
Merge own dev branch into main dev branch
Diffstat (limited to 'src/api/routes/admin/fileGET.js')
-rw-r--r--src/api/routes/admin/fileGET.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/api/routes/admin/fileGET.js b/src/api/routes/admin/fileGET.js
index 3bb8da4..9605da4 100644
--- a/src/api/routes/admin/fileGET.js
+++ b/src/api/routes/admin/fileGET.js
@@ -3,7 +3,7 @@ const Util = require('../../utils/Util');
class filesGET extends Route {
constructor() {
- super('/file/:id', 'get', { adminOnly: true });
+ super('/admin/file/:id', 'get', { adminOnly: true });
}
async run(req, res, db) {
@@ -11,7 +11,10 @@ class filesGET extends Route {
if (!id) return res.status(400).json({ message: 'Invalid file ID supplied' });
let file = await db.table('files').where({ id }).first();
- const user = await db.table('users').where({ id: file.userId }).first();
+ const user = await db.table('users')
+ .select('id', 'username', 'enabled', 'createdAt', 'editedAt', 'apiKeyEditedAt', 'isAdmin')
+ .where({ id: file.userId })
+ .first();
file = Util.constructFilePublicLink(file);
// Additional relevant data