Linear Flow Probation #224

This commit is contained in:
harid 2026-06-29 14:30:34 +07:00
parent 47bbfcc2ae
commit c5675359b3

View file

@ -1204,6 +1204,8 @@ export class ReportController extends Controller {
},
) {
try {
// old cicle flow
/*
await new CallAPI().PostData(request, "/org/command/excexute/salary-probation", {
data: body.refIds.map((v) => ({
profileId: v.refId,
@ -1236,6 +1238,32 @@ export class ReportController extends Controller {
);
return new HttpSuccess();
*/
// 1) Linear Flow: อัปเดต probation_status = 9 (ผ่านทดลองงาน) — bulk update แทน N+1 save
await this.personalRepository.update(
{
probation_status: 8,
personal_id: In(body.refIds.map((x) => x.refId)),
},
{ probation_status: 9 },
);
// 2) return data ให้ org ทำงานต่อ
return body.refIds.map((v) => ({
profileId: v.refId,
commandId: v.commandId,
amount: v.amount,
amountSpecial: v.amountSpecial,
positionSalaryAmount: v.positionSalaryAmount,
mouthSalaryAmount: v.mouthSalaryAmount,
commandNo: v.commandNo,
commandYear: v.commandYear,
commandDateAffect: v.commandDateAffect,
commandDateSign: v.commandDateSign,
commandCode: v.commandCode,
commandName: v.commandName,
remark: v.remark,
}));
} catch (error: any) {
if (error instanceof HttpError) {
throw error;
@ -1321,6 +1349,8 @@ export class ReportController extends Controller {
},
) {
try {
// old cicle flow
/*
await new CallAPI().PostData(request, "/org/command/excexute/salary-probation-leave", {
data: body.refIds.map((v) => ({
profileId: v.refId,
@ -1354,6 +1384,33 @@ export class ReportController extends Controller {
);
return new HttpSuccess();
*/
// 1) Linear Flow: อัปเดต probation_status = 9 — bulk update แทน N+1 save
await this.personalRepository.update(
{
probation_status: 8,
personal_id: In(body.refIds.map((x) => x.refId)),
},
{ probation_status: 9 },
);
// 2) return data ให้ org ทำงานต่อ
return body.refIds.map((v) => ({
profileId: v.refId,
commandId: v.commandId,
amount: v.amount,
amountSpecial: v.amountSpecial,
positionSalaryAmount: v.positionSalaryAmount,
mouthSalaryAmount: v.mouthSalaryAmount,
isGovernment: false,
commandNo: v.commandNo,
commandYear: v.commandYear,
commandDateAffect: v.commandDateAffect,
commandDateSign: v.commandDateSign,
commandCode: v.commandCode,
commandName: v.commandName,
remark: v.remark,
}));
} catch (error: any) {
if (error instanceof HttpError) {
throw error;
@ -1453,6 +1510,7 @@ export class ReportController extends Controller {
}),
);
return new HttpSuccess();
} catch (error: any) {
if (error instanceof HttpError) {
throw error;