Revert auth changes
This commit is contained in:
@ -8,9 +8,8 @@ import { presentApiKey } from '../presenters';
|
||||
import { ApiKey } from '../models';
|
||||
|
||||
const router = new Router();
|
||||
router.use(auth());
|
||||
|
||||
router.post('apiKeys.create', async ctx => {
|
||||
router.post('apiKeys.create', auth(), async ctx => {
|
||||
const { name } = ctx.body;
|
||||
ctx.assertPresent(name, 'name is required');
|
||||
|
||||
@ -26,7 +25,7 @@ router.post('apiKeys.create', async ctx => {
|
||||
};
|
||||
});
|
||||
|
||||
router.post('apiKeys.list', pagination(), async ctx => {
|
||||
router.post('apiKeys.list', auth(), pagination(), async ctx => {
|
||||
const user = ctx.state.user;
|
||||
const keys = await ApiKey.findAll({
|
||||
where: {
|
||||
@ -47,7 +46,7 @@ router.post('apiKeys.list', pagination(), async ctx => {
|
||||
};
|
||||
});
|
||||
|
||||
router.post('apiKeys.delete', async ctx => {
|
||||
router.post('apiKeys.delete', auth(), async ctx => {
|
||||
const { id } = ctx.body;
|
||||
ctx.assertPresent(id, 'id is required');
|
||||
|
||||
|
@ -7,13 +7,12 @@ import auth from './middlewares/authentication';
|
||||
import { presentUser } from '../presenters';
|
||||
|
||||
const router = new Router();
|
||||
router.use(auth());
|
||||
|
||||
router.post('user.info', async ctx => {
|
||||
router.post('user.info', auth(), async ctx => {
|
||||
ctx.body = { data: await presentUser(ctx, ctx.state.user) };
|
||||
});
|
||||
|
||||
router.post('user.update', async ctx => {
|
||||
router.post('user.update', auth(), async ctx => {
|
||||
const { user } = ctx.state;
|
||||
const { name, avatarUrl } = ctx.body;
|
||||
const endpoint = publicS3Endpoint();
|
||||
@ -29,7 +28,7 @@ router.post('user.update', async ctx => {
|
||||
ctx.body = { data: await presentUser(ctx, user) };
|
||||
});
|
||||
|
||||
router.post('user.s3Upload', async ctx => {
|
||||
router.post('user.s3Upload', auth(), async ctx => {
|
||||
const { filename, kind, size } = ctx.body;
|
||||
ctx.assertPresent(filename, 'filename is required');
|
||||
ctx.assertPresent(kind, 'kind is required');
|
||||
|
@ -6,9 +6,8 @@ import { presentView } from '../presenters';
|
||||
import { View, Document } from '../models';
|
||||
|
||||
const router = new Router();
|
||||
router.use(auth());
|
||||
|
||||
router.post('views.list', async ctx => {
|
||||
router.post('views.list', auth(), async ctx => {
|
||||
const { id } = ctx.body;
|
||||
ctx.assertPresent(id, 'id is required');
|
||||
|
||||
@ -37,7 +36,7 @@ router.post('views.list', async ctx => {
|
||||
};
|
||||
});
|
||||
|
||||
router.post('views.create', async ctx => {
|
||||
router.post('views.create', auth(), async ctx => {
|
||||
const { id } = ctx.body;
|
||||
ctx.assertPresent(id, 'id is required');
|
||||
|
||||
|
Reference in New Issue
Block a user