diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index 32ddde5b..d3d312e4 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -2166,7 +2166,6 @@ export class CommandController extends Controller { firstName: profile.firstName, lastName: profile.lastName, email: profile.email, - requiredActions: ["UPDATE_PASSWORD"], }); if (typeof userKeycloakId !== "string") { throw new Error(userKeycloakId.errorMessage); @@ -2188,9 +2187,9 @@ export class CommandController extends Controller { await this.profileRepository.save(profile); setLogDataDiff(req, { before, after: profile }); } - if(profile && profile.id) { + if (profile && profile.id) { //Educations - if(item.bodyEducations && item.bodyEducations.length > 0) { + if (item.bodyEducations && item.bodyEducations.length > 0) { await Promise.all( item.bodyEducations.map(async (education) => { const profileEdu = new ProfileEducation(); @@ -2205,9 +2204,9 @@ export class CommandController extends Controller { }), ); } - + //Certificates - if(item.bodyCertificates && item.bodyCertificates.length > 0) { + if (item.bodyCertificates && item.bodyCertificates.length > 0) { await Promise.all( item.bodyCertificates.map(async (cer) => { const profileCer = new ProfileCertificate(); @@ -2223,7 +2222,7 @@ export class CommandController extends Controller { ); } //Salary - if(item.bodySalarys && item.bodySalarys != null) { + if (item.bodySalarys && item.bodySalarys != null) { const dest_item = await this.salaryRepo.findOne({ where: { profileId: profile.id }, order: { order: "DESC" }, @@ -2232,7 +2231,7 @@ export class CommandController extends Controller { Object.assign(profileSal, { ...item.bodySalarys, ...meta }); const salaryHistory = new ProfileSalaryHistory(); Object.assign(salaryHistory, { ...profileSal, id: undefined }); - profileSal.order = dest_item == null ? 1 : dest_item.order + 1 + profileSal.order = dest_item == null ? 1 : dest_item.order + 1; profileSal.profileId = profile.id; await this.salaryRepo.save(profileSal, { data: req }); setLogDataDiff(req, { before, after: profileSal }); @@ -2240,11 +2239,11 @@ export class CommandController extends Controller { await this.salaryHistoryRepo.save(salaryHistory, { data: req }); } //Position - if(item.bodyPosition && item.bodyPosition != null) { + if (item.bodyPosition && item.bodyPosition != null) { const posMaster = await this.posMasterRepository.findOne({ where: { id: item.bodyPosition.posmasterId }, }); - if (posMaster == null) + if (posMaster == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งนี้"); const posMasterOld = await this.posMasterRepository.findOne({ @@ -2295,7 +2294,7 @@ export class CommandController extends Controller { profile.posLevelId = positionNew.posLevelId; profile.posTypeId = positionNew.posTypeId; profile.position = positionNew.positionName; - await this.profileRepository.save(profile, { data: req }); + await this.profileRepository.save(profile, { data: req }); setLogDataDiff(req, { before, after: profile }); await this.positionRepository.save(positionNew, { data: req }); } diff --git a/src/controllers/UserController.ts b/src/controllers/UserController.ts index 911a4762..456de900 100644 --- a/src/controllers/UserController.ts +++ b/src/controllers/UserController.ts @@ -98,7 +98,6 @@ export class KeycloakController extends Controller { firstName: body.firstName, lastName: body.lastName, email: body.email, - requiredActions: ["UPDATE_PASSWORD"], }); if (typeof userId !== "string") { diff --git a/src/keycloak/index.ts b/src/keycloak/index.ts index 19856b99..0bc0b49f 100644 --- a/src/keycloak/index.ts +++ b/src/keycloak/index.ts @@ -75,7 +75,7 @@ export async function createUser(username: string, password: string, opts?: Reco method: "POST", body: JSON.stringify({ enabled: true, - credentials: [{ type: "password", value: password }], + credentials: [{ type: "password", value: password ,temporary: false,}], username, ...opts, }),