import express from 'express';
import { wrapAsync } from '@/api/http/request';
import * as users from '@/api/controllers/users.controller';
import permissions from '@/middlewares/check-permissions';

const router = express.Router();

router.use(permissions.checkCrudPermissions('users'));

router.post('/', wrapAsync(users.create));
router.post('/bulk-import', wrapAsync(users.bulkImport));
router.put('/:id', wrapAsync(users.update));
router.delete('/:id', wrapAsync(users.remove));
router.post('/deleteByIds', wrapAsync(users.deleteByIds));
router.get('/', wrapAsync(users.list));
router.get('/count', wrapAsync(users.count));
router.get('/autocomplete', wrapAsync(users.autocomplete));
router.get('/:id', wrapAsync(users.findById));

export default router;
