lint
This commit is contained in:
parent
7600712125
commit
94e39d74bf
@ -7,7 +7,6 @@ import {
|
|||||||
} from '../utils/s3';
|
} from '../utils/s3';
|
||||||
import auth from './authentication';
|
import auth from './authentication';
|
||||||
import { presentUser } from '../presenters';
|
import { presentUser } from '../presenters';
|
||||||
import { User } from '../models';
|
|
||||||
|
|
||||||
const router = new Router();
|
const router = new Router();
|
||||||
|
|
||||||
@ -16,7 +15,7 @@ router.post('user.info', auth(), async (ctx) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
router.post('user.s3Upload', auth(), async (ctx) => {
|
router.post('user.s3Upload', auth(), async (ctx) => {
|
||||||
let { filename, kind, size } = ctx.body;
|
const { filename, kind, size } = ctx.body;
|
||||||
ctx.assertPresent(filename, 'filename is required');
|
ctx.assertPresent(filename, 'filename is required');
|
||||||
ctx.assertPresent(kind, 'kind is required');
|
ctx.assertPresent(kind, 'kind is required');
|
||||||
ctx.assertPresent(size, 'size is required');
|
ctx.assertPresent(size, 'size is required');
|
||||||
@ -26,24 +25,24 @@ router.post('user.s3Upload', auth(), async (ctx) => {
|
|||||||
const policy = makePolicy();
|
const policy = makePolicy();
|
||||||
|
|
||||||
ctx.body = { data: {
|
ctx.body = { data: {
|
||||||
max_upload_size: process.env.AWS_S3_UPLOAD_MAX_SIZE,
|
max_upload_size: process.env.AWS_S3_UPLOAD_MAX_SIZE,
|
||||||
upload_url: process.env.AWS_S3_UPLOAD_BUCKET_URL,
|
upload_url: process.env.AWS_S3_UPLOAD_BUCKET_URL,
|
||||||
form: {
|
form: {
|
||||||
AWSAccessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
AWSAccessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
||||||
"Cache-Control": "max-age=31557600",
|
'Cache-Control': 'max-age=31557600',
|
||||||
"Content-Type": kind,
|
'Content-Type': kind,
|
||||||
key: key,
|
key,
|
||||||
acl: "public-read",
|
acl: 'public-read',
|
||||||
signature: signPolicy(policy),
|
signature: signPolicy(policy),
|
||||||
policy: policy,
|
policy,
|
||||||
},
|
},
|
||||||
asset: {
|
asset: {
|
||||||
content_type: kind,
|
content_type: kind,
|
||||||
url: `${process.env.AWS_S3_UPLOAD_BUCKET_URL}${s3Key}/${filename}`,
|
url: `${process.env.AWS_S3_UPLOAD_BUCKET_URL}${s3Key}/${filename}`,
|
||||||
name: filename,
|
name: filename,
|
||||||
size: size,
|
size,
|
||||||
},
|
},
|
||||||
}};
|
} };
|
||||||
});
|
});
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
Reference in New Issue
Block a user