From 190451a910d862de6eede60b72ef109e1ba35f05 Mon Sep 17 00:00:00 2001 From: Bright Date: Tue, 4 Mar 2025 13:00:33 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=E0=B8=95=E0=B8=B3=E0=B9=81=E0=B8=AB=E0=B8=99=E0=B9=88=E0=B8=87?= =?UTF-8?q?=E0=B9=83=E0=B8=99=E0=B8=A3=E0=B8=B0=E0=B8=94=E0=B8=B1=E0=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/ProfileSalaryController.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/controllers/ProfileSalaryController.ts b/src/controllers/ProfileSalaryController.ts index dc945be6..b6d95842 100644 --- a/src/controllers/ProfileSalaryController.ts +++ b/src/controllers/ProfileSalaryController.ts @@ -97,14 +97,17 @@ export class ProfileSalaryController extends Controller { })) : []; - const posLevel: any = [ - // { - // year: 1, - // month: 0, - // day: 0, - // name: "ต้น", - // } - ]; + const posLevel = await AppDataSource.query("CALL GetProfileSalaryLevel(?)", [profileId]); + const _posLevel = posLevel.length > 0 ? posLevel[0] : []; + const mapPosLevel = + _posLevel.length > 1 + ? _posLevel.slice(1).map((curr: any, index: number) => ({ + year: curr.Years ? Math.floor(Number(curr.Years)) : 0, + month: curr.Months ? Math.floor(Number(curr.Months)) : 0, + day: curr.Days ? Math.floor(Number(curr.Days)) : 0, + name: _posLevel[index]?.positionLevel, + })) + : []; const posExecutive = await AppDataSource.query("CALL GetProfileSalaryExecutive(?)", [ profileId, @@ -122,7 +125,7 @@ export class ProfileSalaryController extends Controller { return new HttpSuccess({ position: mapPosition, - posLevel: posLevel, + posLevel: mapPosLevel, posExecutive: mapPosExecutive, }); }