From 4aa3c979b8d9b973b42640e75c3f87018a207d82 Mon Sep 17 00:00:00 2001 From: kittapath Date: Thu, 31 Oct 2024 12:53:45 +0700 Subject: [PATCH 1/3] no message --- src/controllers/PositionController.ts | 2 +- src/controllers/ProfileController.ts | 10 +++++----- src/controllers/ProfileEmployeeController.ts | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index d0b66b2e..a65d816f 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -3199,7 +3199,7 @@ export class PositionController extends Controller { ) { let typeCondition: any = {}; let conditionA = - "positions.posTypeId LIKE :posType AND positions.posLevelId LIKE :posLevel AND positions.positionName LIKE :position"; + "posType.posTypeId LIKE :posTypeName AND posLevel.posLevelName LIKE :posLevel AND positions.positionName LIKE :position"; let posType = await this.posTypeRepository.findOne({ where: { id: String(body.posType) }, diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 361d51d1..4358d9f3 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -301,7 +301,7 @@ export class ProfileController extends Controller { // ], relations: ["currentSubDistrict", "currentDistrict", "currentProvince", "profileAvatars"], order: { - profileAvatars: { createdAt: "DESC" }, + profileAvatars: { createdAt: "ASC" }, }, where: { id: id }, }); @@ -527,7 +527,7 @@ export class ProfileController extends Controller { }); const Cert = certs.length > 0 - ? certs.map((item) => ({ + ? certs.slice(-3).map((item) => ({ CertificateType: item.certificateType ?? null, Issuer: item.issuer ?? null, CertificateNo: Extension.ToThaiNumber(item.certificateNo) ?? null, @@ -547,7 +547,7 @@ export class ProfileController extends Controller { }); const Training = trainings.length > 0 - ? trainings.map((item) => ({ + ? trainings.slice(-3).map((item) => ({ Institute: item.department ?? "", Start: item.startDate == null @@ -583,7 +583,7 @@ export class ProfileController extends Controller { }); const Discipline = disciplines.length > 0 - ? disciplines.map((item) => ({ + ? disciplines.slice(-3).map((item) => ({ DisciplineYear: Extension.ToThaiNumber(new Date(item.refCommandDate).getFullYear().toString()) ?? null, @@ -605,7 +605,7 @@ export class ProfileController extends Controller { }); const Education = educations.length > 0 - ? educations.map((item) => ({ + ? educations.slice(-3).map((item) => ({ Institute: item.institute, Start: item.startDate == null diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index 9ea02b5f..4ab568da 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -305,7 +305,7 @@ export class ProfileEmployeeController extends Controller { // ], relations: ["currentSubDistrict", "currentDistrict", "currentProvince", "profileAvatars"], order: { - profileAvatars: { createdAt: "DESC" }, + profileAvatars: { createdAt: "ASC" }, }, where: { id: id }, }); From e974821777c2abf49724cc361f38c3aad7c42e88 Mon Sep 17 00:00:00 2001 From: kittapath Date: Thu, 31 Oct 2024 13:46:32 +0700 Subject: [PATCH 2/3] no message --- src/controllers/PositionController.ts | 2 +- src/controllers/ProfileController.ts | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index a65d816f..d063d06a 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -3199,7 +3199,7 @@ export class PositionController extends Controller { ) { let typeCondition: any = {}; let conditionA = - "posType.posTypeId LIKE :posTypeName AND posLevel.posLevelName LIKE :posLevel AND positions.positionName LIKE :position"; + "posType.posTypeName LIKE :posType AND posLevel.posLevelName LIKE :posLevel AND positions.positionName LIKE :position"; let posType = await this.posTypeRepository.findOne({ where: { id: String(body.posType) }, diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 4358d9f3..eac0d2b6 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -2814,6 +2814,25 @@ export class ProfileController extends Controller { return new HttpSuccess(profile); } + /** + * API รายละเอียดรายการทะเบียนประวัติ + * + * @summary ORG_065 - รายละเอียดรายการทะเบียนประวัติ (ADMIN) #70 + * + * @param {string} id Id ทะเบียนประวัติ + */ + @Get("keycloak") + async getProfileIdByKeycloak(@Request() request: RequestWithUser) { + const profile = await this.profileRepo.findOne({ + where: { keycloak: request.user.sub }, + select:["id"] + }); + + if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); + + return new HttpSuccess(profile.id); + } + @Get("type") async checkRole(@Request() request: RequestWithUser) { let role: any; From c3044ac0b4904763155b409163d813a83fc64a0d Mon Sep 17 00:00:00 2001 From: Bright Date: Thu, 31 Oct 2024 15:18:46 +0700 Subject: [PATCH 3/3] =?UTF-8?q?fix=20#708=20=E0=B8=A3=E0=B8=B2=E0=B8=A2?= =?UTF-8?q?=E0=B8=8A=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=97=E0=B8=B5=E0=B9=88?= =?UTF-8?q?=E0=B8=96=E0=B8=B9=E0=B8=81=E0=B8=A5=E0=B8=9A=E0=B9=84=E0=B8=A1?= =?UTF-8?q?=E0=B9=88=E0=B9=81=E0=B8=AA=E0=B8=94=E0=B8=87=E0=B9=83=E0=B8=99?= =?UTF-8?q?=E0=B8=A3=E0=B8=B0=E0=B8=9A=E0=B8=9A=E0=B9=82=E0=B8=84=E0=B8=A3?= =?UTF-8?q?=E0=B8=87=E0=B8=AA=E0=B8=A3=E0=B9=89=E0=B8=B2=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/CommandController.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index a1d8b781..d63f83c0 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -3121,7 +3121,7 @@ export class CommandController extends Controller { }[]; }, ) { - const posMasters = await this.posMasterRepository.find({ where: { id: In(body.refIds) } }); + const posMasters = await this.posMasterRepository.find({ where: { id: In(body.refIds.map(x => x.refId)) } }); const data = posMasters.map((_data) => ({ ..._data, statusReport: "PENDING",