This commit is contained in:
AdisakKanthawilang 2024-07-03 17:51:44 +07:00
parent e30e07b6b4
commit db69247557

View file

@ -247,6 +247,7 @@ export class SalaryController extends Controller {
})
async GetSalaryById(@Path() id: string) {
const salary = await this.salaryRepository.findOne({
relations: ["posType_", "posLevel_"],
where: { id: id },
select: [
"name",
@ -260,10 +261,24 @@ export class SalaryController extends Controller {
"details",
],
});
const formattedData = {
name: salary?.name,
isSpecial: salary?.isSpecial,
posTypeId: salary?.posTypeId,
posTypeName: salary?.posType_.posTypeName,
posLevelId: salary?.posLevelId,
posLevelName: salary?.posLevel_.posLevelName,
isActive: salary?.isActive,
date: salary?.date,
startDate: salary?.startDate,
endDate: salary?.endDate,
details: salary?.details,
};
if (!salary) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผังเงินเดือนนี้");
}
return new HttpSuccess(salary);
return new HttpSuccess(formattedData);
}
/**