fix.save batch insert

This commit is contained in:
Warunee Tamkoo 2026-04-24 10:28:30 +07:00
parent 8912e83227
commit 8f83ab781b

View file

@ -102,10 +102,9 @@ export class ProfileSalaryController extends Controller {
Months: month,
Days: day,
};
// data.push(_mapData);
await this.positionOfficerRepo.save(mapData);
data.push(mapData);
}
// await this.positionOfficerRepo.save(data);
await this.positionOfficerRepo.save(data);
return new HttpSuccess();
}
@ -151,10 +150,9 @@ export class ProfileSalaryController extends Controller {
Months: month,
Days: day,
};
// data.push(_mapData);
await this.positionEmployeeRepo.save(mapData);
data.push(mapData);
}
// await this.positionEmployeeRepo.save(data);
await this.positionEmployeeRepo.save(data);
return new HttpSuccess();
}
@ -210,10 +208,9 @@ export class ProfileSalaryController extends Controller {
Months: x.posLevel == null ? 0 : month.toFixed(4),
Days: x.posLevel == null ? 0 : day.toFixed(4),
};
// data.push(_mapData);
await this.levelOfficerRepo.save(mapData);
data.push(mapData);
}
// await this.levelOfficerRepo.save(data);
await this.levelOfficerRepo.save(data);
return new HttpSuccess();
}
@ -269,16 +266,16 @@ export class ProfileSalaryController extends Controller {
Months: x.posLevel == null ? 0 : month.toFixed(4),
Days: x.posLevel == null ? 0 : day.toFixed(4),
};
// data.push(_mapData);
await this.levelEmployeeRepo.save(mapData);
data.push(mapData);
}
// await this.levelEmployeeRepo.save(data);
await this.levelEmployeeRepo.save(data);
return new HttpSuccess();
}
@Get("TenurePositionExecutiveOfficer")
public async cronjobTenureExecutivePositionOfficer() {
let data: any = [];
await this.positionExecutiveOfficerRepo.clear();
const profile = await this.profileRepo.find();
const orgRevision = await this.orgRevisionRepository.findOne({
@ -339,8 +336,9 @@ export class ProfileSalaryController extends Controller {
Months: month.toFixed(4),
Days: day.toFixed(4),
};
await this.positionExecutiveOfficerRepo.save(mapData);
data.push(mapData);
}
await this.positionExecutiveOfficerRepo.save(data);
return new HttpSuccess();
}