From 3163b701c910bff4b2d9cc1a3788c0a90663e22f Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Tue, 28 Apr 2026 15:50:00 +0700 Subject: [PATCH] reset password change profileId to keycloak --- src/controllers/UserController.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/controllers/UserController.ts b/src/controllers/UserController.ts index 923287e2..2120dcff 100644 --- a/src/controllers/UserController.ts +++ b/src/controllers/UserController.ts @@ -816,20 +816,20 @@ export class KeycloakController extends Controller { @Post("user/reset-password") @Security("bearerAuth", ["admin"]) - async resetUserPassword(@Request() req: RequestWithUser, @Body() body: { profileId: string }) { + async resetUserPassword(@Request() req: RequestWithUser, @Body() body: { keycloak: string }) { if (!req.user.role.includes("ADMIN") && !req.user.role.includes("SUPER_ADMIN")) { throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ดำเนินการ"); } let profile: Profile | ProfileEmployee | null = await this.profileRepo.findOne({ - where: { id: body.profileId }, + where: { keycloak: body.keycloak }, select: ["id", "keycloak", "birthDate", "firstName", "lastName", "citizenId"], }); let isEmployee = false; if (!profile) { profile = await this.profileEmpRepo.findOne({ - where: { id: body.profileId, employeeClass: "PERM" }, + where: { keycloak: body.keycloak, employeeClass: "PERM" }, select: ["id", "keycloak", "birthDate", "firstName", "lastName", "citizenId"], }); isEmployee = true;