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

View file

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