FIX: getRole, updateRole, and deleteRole handler

This commit is contained in:
MohammadHMazarei
2024-12-25 19:44:58 +03:30
parent fdd136ac40
commit 0dc408f014
+5 -8
View File
@@ -14,10 +14,7 @@ exports.getAllRoles = catchAsync(async (req, res, next) => {
})
exports.createRole = catchAsync(async (req, res, next) => {
const role = await roleService.createRole(
req.body.englishName,
req.body.persianName
)
const role = await roleService.createRole(req.body)
res.status(201).json({
status: 'success',
@@ -26,7 +23,7 @@ exports.createRole = catchAsync(async (req, res, next) => {
})
exports.getRole = catchAsync(async (req, res, next) => {
const role = await roleService.getRole(req.body.id)
const role = await roleService.getRole(req.params.roleId)
res.status(200).json({
status: 'success',
@@ -35,15 +32,15 @@ exports.getRole = catchAsync(async (req, res, next) => {
})
exports.updateRole = catchAsync(async (req, res, next) => {
const updateRole = await roleService.updateRole(data)
const updateRole = await roleService.updateRole(req.params.roleId, req.body)
res.status(200).json({
status: 'success',
data: role,
data: updateRole,
})
})
exports.deleteRole = catchAsync(async (req, res, next) => {
await roleService.deleteRole(req.body.id)
await roleService.deleteRole(req.params.roleId)
res.status(204).json({
status: 'success',