แก้ SLR_018 , ลบ return id

This commit is contained in:
Bright 2024-02-27 17:14:22 +07:00
parent 1be7261ba0
commit 5f222498cb
6 changed files with 21 additions and 16 deletions

View file

@ -516,7 +516,7 @@ export class SalaryPeriodController extends Controller {
where: { id: id },
});
if (!chk_SalaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดี: " + id);
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดี");
}
const chk_toUpper = ["SPECIAL", "APR", "OCT"];
@ -560,7 +560,13 @@ export class SalaryPeriodController extends Controller {
where: { id: id },
});
if (!SalaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดี: " + id);
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดี");
}
const SalaryOrg = await this.salaryOrgRepository.findOne({
where: { salaryPeriodId: SalaryPeriod.id }
})
if(SalaryOrg){
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่สามารถลบได้");
}
await this.salaryPeriodRepository.remove(SalaryPeriod);
return new HttpSuccess();
@ -580,7 +586,7 @@ export class SalaryPeriodController extends Controller {
select: ["id", "period", "isActive", "effectiveDate", "isActive", "status", "year"],
});
if (!salaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดี: " + id);
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดี");
}
return new HttpSuccess(salaryPeriod);
}