save profile salary

This commit is contained in:
kittapath 2025-01-08 14:15:28 +07:00
parent 3a0fc39397
commit 479e9a3938
14 changed files with 817 additions and 129 deletions

View file

@ -119,10 +119,11 @@ export class ProfileSalaryController extends Controller {
createdFullName: req.user.name,
lastUpdateUserId: req.user.sub,
lastUpdateFullName: req.user.name,
refCommandDate: new Date(),
createdAt: new Date(),
lastUpdatedAt: new Date(),
};
const _null:any = null;
const _null: any = null;
Object.assign(data, { ...body, ...meta });
const history = new ProfileSalaryHistory();
Object.assign(history, { ...data, id: undefined });
@ -131,11 +132,11 @@ export class ProfileSalaryController extends Controller {
history.profileSalaryId = data.id;
await this.salaryHistoryRepo.save(history, { data: req });
profile.amount = body?.amount??_null;
profile.positionSalaryAmount = body?.positionSalaryAmount??_null;
profile.mouthSalaryAmount = body.mouthSalaryAmount??_null;
profile.amount = body?.amount ?? _null;
profile.positionSalaryAmount = body?.positionSalaryAmount ?? _null;
profile.mouthSalaryAmount = body.mouthSalaryAmount ?? _null;
await this.profileRepo.save(profile, { data: req });
return new HttpSuccess();
}
@ -164,6 +165,7 @@ export class ProfileSalaryController extends Controller {
createdFullName: req.user.name,
lastUpdateUserId: req.user.sub,
lastUpdateFullName: req.user.name,
refCommandDate: new Date(),
createdAt: new Date(),
lastUpdatedAt: new Date(),
};
@ -176,7 +178,7 @@ export class ProfileSalaryController extends Controller {
history.profileSalaryId = data.id;
await this.salaryHistoryRepo.save(history, { data: req });
let null_:any = null;
let null_: any = null;
profile.amount = body.amount ?? null_;
profile.amountSpecial = body.amountSpecial ?? null_;
profile.positionSalaryAmount = body.positionSalaryAmount ?? null_;
@ -208,6 +210,7 @@ export class ProfileSalaryController extends Controller {
history.lastUpdateFullName = req.user.name;
history.createdUserId = req.user.sub;
history.createdFullName = req.user.name;
record.refCommandDate = new Date();
history.createdAt = new Date();
history.lastUpdatedAt = new Date();