fix update salary preriod

This commit is contained in:
AdisakKanthawilang 2024-02-23 11:40:08 +07:00
parent aaaf4f548c
commit 2cef1f1b76

View file

@ -101,12 +101,13 @@ export class SalaryPeriodController extends Controller {
const chk_period = await this.salaryPeriodRepository.findOne({
where: {
period: requestBody.period,
id: Not(id),
effectiveDate: Between(startOfYear, endOfYear)
},
});
if (chk_period) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ประเภทผังปี "+ requestBody.effectiveDate.getFullYear() +" ซ้ำ");
throw new HttpError(HttpStatusCode.NOT_FOUND, "ประเภทผังปี "+ (requestBody.effectiveDate.getFullYear()+543) +" ซ้ำ");
}
chk_SalaryPeriod.period = requestBody.period.toUpperCase();