Merge branch 'develop' of github.com:Frappet/bma-ehr-salary into develop

This commit is contained in:
Kittapath 2024-07-03 18:01:05 +07:00
commit 01355ddfef

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);
}
/**