From fb158b24577b1cc6668d7f36633f2971e5e171fd Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Thu, 18 Apr 2024 16:39:49 +0700 Subject: [PATCH] fix: missing parameter username on edit --- src/controllers/user-controller.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/controllers/user-controller.ts b/src/controllers/user-controller.ts index 51092fe..b0f0780 100644 --- a/src/controllers/user-controller.ts +++ b/src/controllers/user-controller.ts @@ -23,6 +23,7 @@ import { addUserRoles, createUser, deleteUser, + editUser, getRoles, getUserRoles, removeUserRoles, @@ -77,6 +78,8 @@ type UserCreate = { type UserUpdate = { status?: "ACTIVE" | "INACTIVE"; + username?: string; + userType?: UserType; userRole?: string; @@ -373,6 +376,10 @@ export class UserController extends Controller { userRole = role.name; } + if (body.username) { + await editUser(userId, { username: body.username }); + } + const { provinceId, districtId, subDistrictId, ...rest } = body; const user = await prisma.user.findFirst({