fix update prefix and profileId
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m45s

This commit is contained in:
Warunee Tamkoo 2026-02-27 15:24:51 +07:00
parent e4f46a1762
commit 2951630b7b
10 changed files with 201 additions and 69 deletions

View file

@ -122,7 +122,12 @@ export class ProfileChangeNameEmployeeController extends Controller {
setLogDataDiff(req, { before, after: profile });
if (profile != null && profile.keycloak != null) {
const result = await updateName(profile.keycloak, profile.firstName, profile.lastName);
const result = await updateName(
profile.keycloak,
profile.firstName,
profile.lastName,
profile.prefix,
);
if (!result) {
throw new Error(result.errorMessage);
}
@ -195,16 +200,17 @@ export class ProfileChangeNameEmployeeController extends Controller {
* @param trainingId -
*/
@Patch("update-delete/{changeNameId}")
public async updateIsDeleted(
@Request() req: RequestWithUser,
@Path() changeNameId: string,
) {
public async updateIsDeleted(@Request() req: RequestWithUser, @Path() changeNameId: string) {
const record = await this.changeNameRepository.findOneBy({ id: changeNameId });
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
if (record.isDeleted === true) {
return new HttpSuccess();
}
await new permission().PermissionOrgUserDelete(req, "SYS_REGISTRY_EMP", record.profileEmployeeId);
await new permission().PermissionOrgUserDelete(
req,
"SYS_REGISTRY_EMP",
record.profileEmployeeId,
);
const before = structuredClone(record);
const history = new ProfileChangeNameHistory();
const now = new Date();