fix errors
This commit is contained in:
1 parent
5159d43cad
commit
f31ff994fe
4 files changed
+3
-12
No files matched your search
@@ -12,10 +12,8 @@ import {
|
||||
editSuperadminUserByIdBodyValidation,
|
||||
editUserPasswordByIdBodyValidation,
|
||||
} from "../../validation/joi.js";
|
||||
import ErrorService from "../../service/v1/infrastructure/errorService.js";
|
||||
|
||||
const SERVICE_NAME = "authController";
|
||||
const errorService = new ErrorService();
|
||||
/**
|
||||
* Authentication Controller
|
||||
*
|
||||
@@ -438,7 +436,7 @@ class AuthController extends BaseController {
|
||||
async (req, res) => {
|
||||
const roles = req?.user?.role;
|
||||
if (!roles.includes("superadmin")) {
|
||||
throw errorService.createError("Unauthorized", 403);
|
||||
throw this.errorService.createError("Unauthorized", 403);
|
||||
}
|
||||
|
||||
const userId = req.params.userId;
|
||||
@@ -462,7 +460,7 @@ class AuthController extends BaseController {
|
||||
async (req, res) => {
|
||||
const roles = req?.user?.role;
|
||||
if (!roles.includes("superadmin")) {
|
||||
throw errorService.createError("Unauthorized", 403);
|
||||
throw this.errorService.createError("Unauthorized", 403);
|
||||
}
|
||||
|
||||
const userId = req.params.userId;
|
||||
|
||||
@@ -671,8 +671,6 @@ const editSuperadminUserByIdBodyValidation = joi.object({
|
||||
});
|
||||
|
||||
const editUserPasswordByIdBodyValidation = joi.object({
|
||||
email: joi.string().required(),
|
||||
newPassword: joi.string().min(8).required().pattern(passwordPattern),
|
||||
password: joi.string().min(8).required().pattern(passwordPattern),
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user