import express from 'express';
import * as controller from '../controllers/product-group.controller';
import { createAuthMiddleware } from '../auth';
import { MODERATOR } from '../auth/constants';

const router = express.Router();

router.use(createAuthMiddleware(MODERATOR));
router.get('/', controller.list);
router.post('/', controller.create);
router.put('/:id', controller.update);
router.delete('/:id', controller.destroy);

export default router;

import express from 'express';
import * as controller from '../controllers/product-group.controller';
import { createAuthMiddleware } from '../auth';
import { MODERATOR, TOKEN } from '../auth/constants';

const router = express.Router();

router.get('/', createAuthMiddleware(TOKEN), controller.list);
router.post('/', createAuthMiddleware(MODERATOR), controller.create);
router.put('/:id', createAuthMiddleware(MODERATOR), controller.update);
router.delete('/:id', createAuthMiddleware(MODERATOR), controller.destroy);

export default router;

Change product group api authentication