API ลบผังเงินเดือน
This commit is contained in:
parent
bf8f0c207d
commit
f6b1ac9d1c
1 changed files with 27 additions and 0 deletions
|
|
@ -188,6 +188,33 @@ export class Salary extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* API ลบผังเงินเดือน
|
||||
*
|
||||
* @summary SLR_003 - ลบผังเงินเดือน #3
|
||||
*
|
||||
* @param {string} id Guid, *Id ผังเงินเดือน
|
||||
*/
|
||||
@Delete("{id}")
|
||||
async delete_salary(@Path() id: string) {
|
||||
const chk_Salary = await this.salaryRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
if (!chk_Salary) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดี: "+ id);
|
||||
}
|
||||
if (chk_Salary.isActive) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่สามารถลบไอดี: " + id + " ได้ เนื่องสถานะการใช้งานที่เป็น Default");
|
||||
}
|
||||
|
||||
try {
|
||||
await this.salaryRepository.remove(chk_Salary);
|
||||
return new HttpSuccess();
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue