แก้ api ที่ดึง amount จาก profile salary เป็นจาก profile

This commit is contained in:
AdisakKanthawilang 2024-12-06 09:18:26 +07:00
parent 04c200027f
commit 6f4d6d14b7
6 changed files with 37 additions and 22 deletions

View file

@ -122,7 +122,7 @@ export class ProfileSalaryController extends Controller {
createdAt: new Date(),
lastUpdatedAt: new Date(),
};
const _null:any = null;
Object.assign(data, { ...body, ...meta });
const history = new ProfileSalaryHistory();
Object.assign(history, { ...data, id: undefined });
@ -131,6 +131,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;
await this.profileRepo.save(profile, { data: req });
return new HttpSuccess();
}