reset password change profileId to keycloak
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m12s

This commit is contained in:
Warunee Tamkoo 2026-04-28 15:50:00 +07:00
parent 58afa49fcd
commit 3163b701c9

View file

@ -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;