fix: missing parameter username on edit

This commit is contained in:
Methapon2001 2024-04-18 16:39:49 +07:00
parent 4750f1945d
commit fb158b2457

View file

@ -23,6 +23,7 @@ import {
addUserRoles, addUserRoles,
createUser, createUser,
deleteUser, deleteUser,
editUser,
getRoles, getRoles,
getUserRoles, getUserRoles,
removeUserRoles, removeUserRoles,
@ -77,6 +78,8 @@ type UserCreate = {
type UserUpdate = { type UserUpdate = {
status?: "ACTIVE" | "INACTIVE"; status?: "ACTIVE" | "INACTIVE";
username?: string;
userType?: UserType; userType?: UserType;
userRole?: string; userRole?: string;
@ -373,6 +376,10 @@ export class UserController extends Controller {
userRole = role.name; userRole = role.name;
} }
if (body.username) {
await editUser(userId, { username: body.username });
}
const { provinceId, districtId, subDistrictId, ...rest } = body; const { provinceId, districtId, subDistrictId, ...rest } = body;
const user = await prisma.user.findFirst({ const user = await prisma.user.findFirst({