From 8c30dc56f49ef6f3cd5aeec7ac2db7453bbb308a Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Thu, 20 Mar 2025 18:03:47 +0700 Subject: [PATCH] fix --- src/controllers/ProfileSalaryTempController.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/controllers/ProfileSalaryTempController.ts b/src/controllers/ProfileSalaryTempController.ts index 523247ef..1f4900c2 100644 --- a/src/controllers/ProfileSalaryTempController.ts +++ b/src/controllers/ProfileSalaryTempController.ts @@ -29,8 +29,7 @@ import { ProfileEmployee } from "../entities/ProfileEmployee"; import permission from "../interfaces/permission"; import { OrgRevision } from "../entities/OrgRevision"; import Extension from "../interfaces/extension"; -import { log } from "console"; -@Route("api/v1/org/profile/salaryTemp") + @Route("api/v1/org/profile/salaryTemp") @Tags("ProfileSalaryTemp") @Security("bearerAuth") export class ProfileSalaryTempController extends Controller { @@ -88,7 +87,7 @@ export class ProfileSalaryTempController extends Controller { orgRevisionId: findRevision.id, }) .andWhere( - statusCheckEdit != undefined && statusCheckEdit != null + statusCheckEdit != undefined && statusCheckEdit != null && statusCheckEdit.toUpperCase() != "ALL" ? "profile.statusCheckEdit = :statusCheckEdit" : "1=1", { @@ -640,7 +639,10 @@ export class ProfileSalaryTempController extends Controller { @Request() req: RequestWithUser, ) { if (type.toLocaleUpperCase() == "OFFICER") { - const salary = await this.salaryRepo.find({ where: { profileId: profileId } }); + const salary = await this.salaryRepo.find({ + where: { profileId: profileId }, + order: { order: "ASC" } + }); if (salary.length <= 0) { let salaryOld = await this.salaryOldRepo.find({ where: { profileId: profileId }, @@ -669,7 +671,10 @@ export class ProfileSalaryTempController extends Controller { } return new HttpSuccess(salary); } else { - const salary = await this.salaryRepo.find({ where: { profileEmployeeId: profileId } }); + const salary = await this.salaryRepo.find({ + where: { profileEmployeeId: profileId }, + order: { order: "ASC" } + }); if (salary.length <= 0) { let salaryOld = await this.salaryOldRepo.find({ where: { profileEmployeeId: profileId },