แก้ฟิวvalidate

This commit is contained in:
Kittapath 2024-02-28 16:04:09 +07:00
parent 8339e6ce6d
commit 442f2f9a86
2 changed files with 21 additions and 16 deletions

View file

@ -480,7 +480,8 @@ export class SalaryPeriodController extends Controller {
);
}
const salaryProfile = Object.assign(new SalaryProfile(), requestBody);
let salaryProfile: any = Object.assign(new SalaryProfile(), requestBody);
delete salaryProfile.id;
salaryProfile.type = salaryProfile.type.toUpperCase();
//Type & Level
const type = await this.posTypeRepository.findOne({
@ -557,7 +558,9 @@ export class SalaryPeriodController extends Controller {
: salaryRanks.salaryFullHalf - salaryProfile.amount;
salaryProfile.positionSalaryAmount = salaryRanks == null ? 0 : salaryRanks.salaryFullHalf;
} else {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ประเภทการเลื่อนขึ้นเงินเดือนไม่ถูกต้อง");
salaryProfile.amountSpecial = 0;
salaryProfile.amountUse = 0;
salaryProfile.positionSalaryAmount = 0;
}
salaryProfile.salaryOrgId = salaryOrg.id;
@ -807,6 +810,7 @@ export class SalaryPeriodController extends Controller {
await Promise.all(
orgs.map(async (rootId: string) => {
let salaryOrgNew = Object.assign(new SalaryOrg());
delete salaryOrgNew.id;
salaryOrgNew.salaryPeriodId = salaryPeriod.id;
salaryOrgNew.status = "PENDING";
salaryOrgNew.rootId = rootId;
@ -857,6 +861,7 @@ export class SalaryPeriodController extends Controller {
if (salaryOrgNew != null) {
let salaryProfileNew = Object.assign(new SalaryProfile(), profile);
delete profile.id;
salaryProfileNew.salaryOrgId = salaryOrgNew.id;
salaryProfileNew.revisionId = salaryPeriod.revisionId;
salaryProfileNew.createdUserId = request.user.sub;