Fix server-side linting erros
This commit is contained in:
parent
1107f7352a
commit
9de8257464
3 changed files with 42 additions and 43 deletions
|
@ -60,14 +60,14 @@ export function deleteObjectsFromS3(keyList, callback) {
|
|||
}
|
||||
|
||||
export function deleteObjectFromS3(req, res) {
|
||||
const { object_key, user_id } = req.params;
|
||||
let objectKey;
|
||||
if (user_id) {
|
||||
objectKey = `${user_id}/${object_key}`
|
||||
const { objectKey, userId } = req.params;
|
||||
let fullObjectKey;
|
||||
if (userId) {
|
||||
fullObjectKey = `${userId}/${objectKey}`;
|
||||
} else {
|
||||
objectKey = object_key;
|
||||
fullObjectKey = objectKey;
|
||||
}
|
||||
deleteObjectsFromS3([objectKey], () => {
|
||||
deleteObjectsFromS3([fullObjectKey], () => {
|
||||
res.json({ success: true });
|
||||
});
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ export function signS3(req, res) {
|
|||
policy: p.policy,
|
||||
signature: p.signature
|
||||
};
|
||||
return res.json(result);
|
||||
res.json(result);
|
||||
}
|
||||
|
||||
export function copyObjectInS3(req, res) {
|
||||
|
@ -135,9 +135,7 @@ export function listObjectsInS3ForUser(userId) {
|
|||
.on('end', () => {
|
||||
resolve();
|
||||
});
|
||||
}).then(() => {
|
||||
return getProjectsForUserId(userId);
|
||||
}).then((projects) => {
|
||||
}).then(() => getProjectsForUserId(userId)).then((projects) => {
|
||||
const projectAssets = [];
|
||||
let totalSize = 0;
|
||||
assets.forEach((asset) => {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable */
|
||||
import mongoose from 'mongoose';
|
||||
|
||||
import User from '../models/user';
|
||||
|
|
|
@ -6,7 +6,7 @@ const router = new Router();
|
|||
|
||||
router.post('/S3/sign', isAuthenticated, AWSController.signS3);
|
||||
router.post('/S3/copy', isAuthenticated, AWSController.copyObjectInS3);
|
||||
router.delete('/S3/:user_id?/:object_key', isAuthenticated, AWSController.deleteObjectFromS3);
|
||||
router.delete('/S3/:userId?/:objectKey', isAuthenticated, AWSController.deleteObjectFromS3);
|
||||
router.get('/S3/objects', AWSController.listObjectsInS3ForUserRequestHandler);
|
||||
|
||||
export default router;
|
||||
|
|
Loading…
Reference in a new issue