diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index 47a0e4ec..3c91dd85 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -3456,11 +3456,9 @@ export class CommandController extends Controller { }[]; }, ) { - console.log("xxxxxxoxxx"); const roleKeycloak = await this.roleKeycloakRepo.findOne({ where: { name: Like("USER") }, }); - console.log("xxxxixxxxx"); await Promise.all( body.data.map(async (item) => { const before = null; @@ -3472,7 +3470,6 @@ export class CommandController extends Controller { createdAt: new Date(), lastUpdatedAt: new Date(), }; - console.log("xxxxxxuxxx"); const _null: any = null; if (item.bodyProfile.posLevelId === "") item.bodyProfile.posLevelId = null; if (item.bodyProfile.posTypeId === "") item.bodyProfile.posTypeId = null; @@ -3482,7 +3479,6 @@ export class CommandController extends Controller { ) { throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลระดับตำแหน่งนี้"); } - console.log("xxxxxyxxxx"); if ( item.bodyProfile.posTypeId && !(await this.posTypeRepo.findOneBy({ id: item.bodyProfile.posTypeId })) @@ -3494,9 +3490,7 @@ export class CommandController extends Controller { where: { citizenId: item.bodyProfile.citizenId }, relations: ["roleKeycloaks"], }); - console.log("xxxxxxtxxx"); if (!profile) { - console.log("xxxrxxxxxx"); profile = Object.assign({ ...item.bodyProfile, ...meta }); profile.dateRetire = item.bodyProfile.birthDate == null @@ -3513,11 +3507,9 @@ export class CommandController extends Controller { // if (typeof userKeycloakId !== "string") { // throw new Error(userKeycloakId.errorMessage); // } - console.log("xxxexxxxxx"); const list = await getRoles(); if (!Array.isArray(list)) throw new Error("Failed. Cannot get role(s) data from the server."); - console.log("xxxxwxxxxx"); const result = await addUserRoles( userKeycloakId, list @@ -3527,7 +3519,6 @@ export class CommandController extends Controller { name: x.name, })), ); - console.log("xxxxxqxxxx"); // if (!result) throw new Error("Failed. Cannot set user's role."); profile.keycloak = typeof userKeycloakId === "string" ? userKeycloakId : ""; profile.roleKeycloaks = result && roleKeycloak ? [roleKeycloak] : []; @@ -3536,16 +3527,11 @@ export class CommandController extends Controller { profile.amount = item.bodyProfile.amount ?? null; profile.amountSpecial = item.bodyProfile.amountSpecial ?? null; await this.profileRepository.save(profile); - console.log("xxxx'xxxxx"); setLogDataDiff(req, { before, after: profile }); - console.log("xxxxx;xxxx"); } - console.log("xxxxlxxxxx"); if (profile && profile.id) { - console.log("xxxxkxxxxx"); //Educations if (item.bodyEducations && item.bodyEducations.length > 0) { - console.log("xxxxxjxxxx"); await Promise.all( item.bodyEducations.map(async (education) => { const profileEdu = new ProfileEducation(); @@ -3561,10 +3547,8 @@ export class CommandController extends Controller { ); } - console.log("xxxxxxhxxx"); //Certificates if (item.bodyCertificates && item.bodyCertificates.length > 0) { - console.log("xxxxxgxxxx"); await Promise.all( item.bodyCertificates.map(async (cer) => { const profileCer = new ProfileCertificate(); @@ -3579,10 +3563,8 @@ export class CommandController extends Controller { }), ); } - console.log("xxxxxfxxxx"); //Salary if (item.bodySalarys && item.bodySalarys != null) { - console.log("xxxxdxxxxx"); const dest_item = await this.salaryRepo.findOne({ where: { profileId: profile.id }, order: { order: "DESC" }, @@ -3603,17 +3585,14 @@ export class CommandController extends Controller { salaryHistory.profileSalaryId = profileSal.id; await this.salaryHistoryRepo.save(salaryHistory, { data: req }); } - console.log("xxxxxxsxxx"); //Position if (item.bodyPosition && item.bodyPosition != null) { - console.log("xxxxaxxxxx"); const posMaster = await this.posMasterRepository.findOne({ where: { id: item.bodyPosition.posmasterId }, }); if (posMaster == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งนี้"); - console.log("xxxxx/xxxx"); const posMasterOld = await this.posMasterRepository.findOne({ where: { current_holderId: profile.id, @@ -3622,7 +3601,6 @@ export class CommandController extends Controller { }); if (posMasterOld != null) posMasterOld.current_holderId = null; - console.log("xxxx.xxxxx"); const positionOld = await this.positionRepository.findOne({ where: { posMasterId: posMasterOld?.id, @@ -3634,7 +3612,6 @@ export class CommandController extends Controller { await this.positionRepository.save(positionOld); } - console.log("xxxx,xxxxx"); const checkPosition = await this.positionRepository.find({ where: { posMasterId: item.bodyPosition.posmasterId, @@ -3649,7 +3626,6 @@ export class CommandController extends Controller { await this.positionRepository.save(clearPosition); } - console.log("xxxxxmxxxx"); posMaster.current_holderId = profile.id; if (posMasterOld != null) await this.posMasterRepository.save(posMasterOld); await this.posMasterRepository.save(posMaster); @@ -3660,9 +3636,7 @@ export class CommandController extends Controller { posMasterId: item.bodyPosition.posmasterId, }, }); - console.log("xxxxxnxxxx"); if (positionNew != null) { - console.log("xxxxbxxxxx"); positionNew.positionIsSelected = true; profile.posLevelId = positionNew.posLevelId; profile.posTypeId = positionNew.posTypeId; @@ -3672,14 +3646,10 @@ export class CommandController extends Controller { setLogDataDiff(req, { before, after: profile }); await this.positionRepository.save(positionNew, { data: req }); } - console.log("xxxxxvxxxx"); } - console.log("xxxxxvxxxx"); } - console.log("xxxxcxxxxx"); }), ); - console.log("xxxxxxxxxx"); return new HttpSuccess(); }