refactor: Use express-async-errors instead of express-async-handler

This commit is contained in:
Faruk AYDIN
2024-08-28 11:10:31 +03:00
parent 6540d0ea53
commit f7ca59bd5f
22 changed files with 68 additions and 157 deletions

View File

@@ -1,5 +1,4 @@
import { Router } from 'express';
import asyncHandler from 'express-async-handler';
import { authenticateUser } from '../../../../helpers/authentication.js';
import { authorizeAdmin } from '../../../../helpers/authorization.js';
import getUsersAction from '../../../../controllers/api/v1/admin/users/get-users.ee.js';
@@ -8,20 +7,8 @@ import deleteUserAction from '../../../../controllers/api/v1/admin/users/delete-
const router = Router();
router.get('/', authenticateUser, authorizeAdmin, asyncHandler(getUsersAction));
router.get(
'/:userId',
authenticateUser,
authorizeAdmin,
asyncHandler(getUserAction)
);
router.delete(
'/:userId',
authenticateUser,
authorizeAdmin,
asyncHandler(deleteUserAction)
);
router.get('/', authenticateUser, authorizeAdmin, getUsersAction);
router.get('/:userId', authenticateUser, authorizeAdmin, getUserAction);
router.delete('/:userId', authenticateUser, authorizeAdmin, deleteUserAction);
export default router;