Merge pull request #2037 from automatisch/refactor-async-errors

refactor: Use express-async-errors instead of express-async-handler
This commit is contained in:
Ömer Faruk Aydın
2024-08-28 12:13:22 +03:00
committed by GitHub
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 { checkIsEnterprise } from '../../../../helpers/check-is-enterprise.js';
@@ -24,7 +23,7 @@ router.get(
authenticateUser,
authorizeAdmin,
checkIsEnterprise,
asyncHandler(getAuthClientsAction)
getAuthClientsAction
);
router.post(
@@ -32,7 +31,7 @@ router.post(
authenticateUser,
authorizeAdmin,
checkIsEnterprise,
asyncHandler(createAuthClientAction)
createAuthClientAction
);
router.get(
@@ -40,7 +39,7 @@ router.get(
authenticateUser,
authorizeAdmin,
checkIsEnterprise,
asyncHandler(getAuthClientAction)
getAuthClientAction
);
export default router;

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 { checkIsEnterprise } from '../../../../helpers/check-is-enterprise.js';
@@ -12,7 +11,7 @@ router.get(
authenticateUser,
authorizeAdmin,
checkIsEnterprise,
asyncHandler(getPermissionsCatalogAction)
getPermissionsCatalogAction
);
export default router;

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 { checkIsEnterprise } from '../../../../helpers/check-is-enterprise.js';
@@ -13,7 +12,7 @@ router.get(
authenticateUser,
authorizeAdmin,
checkIsEnterprise,
asyncHandler(getRolesAction)
getRolesAction
);
router.get(
@@ -21,7 +20,7 @@ router.get(
authenticateUser,
authorizeAdmin,
checkIsEnterprise,
asyncHandler(getRoleAction)
getRoleAction
);
export default router;

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 { checkIsEnterprise } from '../../../../helpers/check-is-enterprise.js';
@@ -14,7 +13,7 @@ router.get(
authenticateUser,
authorizeAdmin,
checkIsEnterprise,
asyncHandler(getSamlAuthProvidersAction)
getSamlAuthProvidersAction
);
router.get(
@@ -22,7 +21,7 @@ router.get(
authenticateUser,
authorizeAdmin,
checkIsEnterprise,
asyncHandler(getSamlAuthProviderAction)
getSamlAuthProviderAction
);
router.get(
@@ -30,7 +29,7 @@ router.get(
authenticateUser,
authorizeAdmin,
checkIsEnterprise,
asyncHandler(getRoleMappingsAction)
getRoleMappingsAction
);
export default router;

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;