This commit is contained in:
AdisakKanthawilang 2024-03-01 11:02:45 +07:00
parent 8b81afe00d
commit 0f76e8d3d9

View file

@ -150,7 +150,7 @@ export class SalaryPeriodController extends Controller {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขอเงินเดือนผู้ใช้งานนี้ในระบบ");
}
// await this.salaryProfileRepository.remove(salaryProfile);
await this.salaryProfileRepository.remove(salaryProfile);
// หาจำนวน Quota คงเหลือ
if (salaryProfile.salaryOrg.snapshot == "SNAP1") {
@ -195,7 +195,7 @@ export class SalaryPeriodController extends Controller {
@Post("change/amount")
async changeAmount(@Body() body: { profileId: string; amount: number }) {
const salaryProfile = await this.salaryProfileRepository.findOne({
relations: ["salaryOrg"],
relations: ["salaryOrg","salaryOrg.salaryPeriod"],
where: { id: body.profileId },
});
if (!salaryProfile) {
@ -285,7 +285,7 @@ export class SalaryPeriodController extends Controller {
}
await this.salaryProfileRepository.save(salaryProfile);
// หาจำนวน Quota คงเหลือ
if (salaryProfile.salaryOrg.snapshot == "SNAP1") {
if(salaryProfile.salaryOrg.salaryPeriod.period == "APR"){
@ -334,6 +334,7 @@ export class SalaryPeriodController extends Controller {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขอเงินเดือนผู้ใช้งานนี้ในระบบ");
}
const salaryOrg = await this.salaryOrgRepository.findOne({
relations: ["salaryPeriod"],
where: { id: body.groupId },
});
if (!salaryOrg) {