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, }); }