Skip to content

Commit

Permalink
[#152] feat: 컨트롤러 및 미들웨어 변경사항을 라우터에 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
domino8788 committed Dec 20, 2020
1 parent a03d750 commit 5b7641f
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions backend/src/routes/block.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Router } from 'express';

import { blockMiddleware } from '@/middlewares';
import { blockController } from '@/controllers';
import { errorHandler } from '@/aops';
import { objectIdValidator } from '@/middlewares';
Expand All @@ -9,7 +10,8 @@ export const blockRouter = Router();
blockRouter.post(
'/parent-id/:parentId',
objectIdValidator('parentId'),
errorHandler(blockController.create),
errorHandler(blockMiddleware.create),
blockController.publish,
);
blockRouter.get(
'/page-id/:pageId',
Expand All @@ -19,23 +21,28 @@ blockRouter.get(
blockRouter.patch(
'/id/:blockId',
objectIdValidator('blockId'),
errorHandler(blockController.update),
errorHandler(blockMiddleware.update),
blockController.publish,
);
blockRouter.patch(
'/id/:blockId/to/:toId',
objectIdValidator('blockId', 'toId'),
errorHandler(blockController.move),
errorHandler(blockMiddleware.move),
blockController.publish,
);
blockRouter.delete(
'/id/:blockId',
objectIdValidator('blockId'),
errorHandler(blockController.deleteCascade),
errorHandler(blockMiddleware.deleteCascade),
blockController.publish,
);
blockRouter.patch(
'/create-and-update',
errorHandler(blockController.createAndUpdate),
errorHandler(blockMiddleware.createAndUpdate),
blockController.publish,
);
blockRouter.patch(
'/delete-and-update',
errorHandler(blockController.deleteAndUpdate),
errorHandler(blockMiddleware.deleteAndUpdate),
blockController.publish,
);

0 comments on commit 5b7641f

Please sign in to comment.