add: updatedById
This commit is contained in:
@@ -68,6 +68,7 @@ class UserController {
|
|||||||
is_active,
|
is_active,
|
||||||
is_approve
|
is_approve
|
||||||
} = req.body;
|
} = req.body;
|
||||||
|
const updatedById = req.user?.user_id;
|
||||||
|
|
||||||
const result = await userService.updateUser({
|
const result = await userService.updateUser({
|
||||||
user_id: parseInt(id, 10),
|
user_id: parseInt(id, 10),
|
||||||
@@ -78,7 +79,8 @@ class UserController {
|
|||||||
role_id,
|
role_id,
|
||||||
is_sa,
|
is_sa,
|
||||||
is_active,
|
is_active,
|
||||||
is_approve
|
is_approve,
|
||||||
|
updatedById
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("PARAM ID:", req.params);
|
console.log("PARAM ID:", req.params);
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ class UserService {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Update user
|
// Update user
|
||||||
updateUser = async ({ user_id, fullname, name, email, phone, role_id, is_sa, is_active, is_approve }) => {
|
updateUser = async ({ user_id, fullname, name, email, phone, role_id, is_sa, is_active, is_approve, updatedById }) => {
|
||||||
try {
|
try {
|
||||||
const user = await getUserByIdDb(user_id);
|
const user = await getUserByIdDb(user_id);
|
||||||
if (!user) throw new ErrorHandler(404, "User not found");
|
if (!user) throw new ErrorHandler(404, "User not found");
|
||||||
@@ -117,7 +117,8 @@ class UserService {
|
|||||||
...(role_id !== undefined && { role_id }),
|
...(role_id !== undefined && { role_id }),
|
||||||
...(is_sa !== undefined && { is_sa }),
|
...(is_sa !== undefined && { is_sa }),
|
||||||
...(is_active !== undefined && { is_active }),
|
...(is_active !== undefined && { is_active }),
|
||||||
...(is_approve !== undefined && { is_approve })
|
...(is_approve !== undefined && { is_approve }),
|
||||||
|
...(updatedById !== undefined && { updated_by: updatedById })
|
||||||
};
|
};
|
||||||
|
|
||||||
await updateUserDb(user_id, updateData);
|
await updateUserDb(user_id, updateData);
|
||||||
|
|||||||
Reference in New Issue
Block a user