แก้ฟิว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;

View file

@ -289,16 +289,16 @@ export class CreateSalaryProfile {
citizenId: string;
@Column()
posMasterNoPrefix: string;
posMasterNoPrefix: string | null;
@Column()
posMasterNo: number;
@Column()
posMasterNoSuffix: string;
posMasterNoSuffix: string | null;
@Column()
orgShortName: string;
orgShortName: string | null;
@Column()
position: string;
@ -310,40 +310,40 @@ export class CreateSalaryProfile {
posLevel: string;
@Column()
posExecutive: string;
posExecutive: string | null;
@Column()
amount: number;
@Column("uuid")
rootId: string;
rootId: string | null;
@Column()
root: string;
root: string | null;
@Column("uuid")
child1Id: string;
child1Id: string | null;
@Column()
child1: string;
child1: string | null;
@Column("uuid")
child2Id: string;
child2Id: string | null;
@Column()
child2: string;
child2: string | null;
@Column("uuid")
child3Id: string;
child3Id: string | null;
@Column()
child3: string;
child3: string | null;
@Column("uuid")
child4Id: string;
child4Id: string | null;
@Column()
child4: string;
child4: string | null;
@Column()
isResult: boolean;