|
|
|
@ -10,16 +10,11 @@ const setupApiRoute = routeHelpers.setupApiRoute;
|
|
|
|
|
module.exports = function () {
|
|
|
|
|
const middlewares = [middleware.authenticate];
|
|
|
|
|
|
|
|
|
|
setupApiRoute(router, '/', middleware, [...middlewares, middleware.checkRequired.bind(null, ['name'])], 'post', controllers.write.categories.create);
|
|
|
|
|
setupApiRoute(router, '/:cid', middleware, [...middlewares], 'put', controllers.write.categories.update);
|
|
|
|
|
|
|
|
|
|
// app.route('/:cid')
|
|
|
|
|
// .delete(apiMiddleware.requireUser, apiMiddleware.requireAdmin, apiMiddleware.validateCid, function(req, res) {
|
|
|
|
|
// Categories.purge(req.params.cid, req.user.uid, function(err) {
|
|
|
|
|
// return errorHandler.handle(err, res);
|
|
|
|
|
// });
|
|
|
|
|
// });
|
|
|
|
|
setupApiRoute(router, '/', middleware, [...middlewares, middleware.checkRequired.bind(null, ['name']), middleware.isAdmin], 'post', controllers.write.categories.create);
|
|
|
|
|
setupApiRoute(router, '/:cid', middleware, [...middlewares, middleware.isAdmin], 'put', controllers.write.categories.update);
|
|
|
|
|
setupApiRoute(router, '/:cid', middleware, [...middlewares, middleware.isAdmin], 'delete', controllers.write.categories.delete);
|
|
|
|
|
|
|
|
|
|
// Category disabled state is deprecated, so this route won't be ported over
|
|
|
|
|
// app.route('/:cid/state')
|
|
|
|
|
// .put(apiMiddleware.requireUser, apiMiddleware.requireAdmin, apiMiddleware.validateCid, function(req, res) {
|
|
|
|
|
// var payload = {};
|
|
|
|
|