fix แก้ไขประวัติส่วนตัว ไม่ปั๊มประวัติรายการคนครอง #244
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m9s

This commit is contained in:
harid 2026-05-28 13:02:58 +07:00
parent ccfb2754fd
commit 521a748de1
2 changed files with 9 additions and 40 deletions

View file

@ -93,6 +93,7 @@ import { CreatePosMasterHistoryOfficer, getTopDegrees, getPosMasterPositions } f
import { ProfileLeaveService } from "../services/ProfileLeaveService";
// import { PostRetireToExprofile } from "./ExRetirementController";
import { getPosNumCodeSit } from "../services/CommandService";
import { updateHolderProfileHistory } from "../services/PositionService";
@Route("api/v1/org/profile")
@Tags("Profile")
@Security("bearerAuth")
@ -5774,26 +5775,7 @@ export class ProfileController extends Controller {
}
if (body.citizenId) {
const citizenIdDigits = body.citizenId.toString().split("").map(Number);
const cal =
citizenIdDigits[0] * 13 +
citizenIdDigits[1] * 12 +
citizenIdDigits[2] * 11 +
citizenIdDigits[3] * 10 +
citizenIdDigits[4] * 9 +
citizenIdDigits[5] * 8 +
citizenIdDigits[6] * 7 +
citizenIdDigits[7] * 6 +
citizenIdDigits[8] * 5 +
citizenIdDigits[9] * 4 +
citizenIdDigits[10] * 3 +
citizenIdDigits[11] * 2;
const calStp2 = cal % 11;
const chkDigit = (11 - calStp2) % 10;
if (citizenIdDigits[12] !== chkDigit) {
throw new HttpError(HttpStatus.NOT_FOUND, "ข้อมูลรหัสบัตรประจำตัวประชาชนไม่ถูกต้อง");
}
Extension.CheckCitizen(body.citizenId);
}
const record = await this.profileRepo.findOneBy({ id });
const before = structuredClone(record);
@ -5833,6 +5815,9 @@ export class ProfileController extends Controller {
}
}
// บันทึกประวัติคนครองตำแหน่ง (ถ้า profile นี้ครองตำแหน่งอยู่)
await updateHolderProfileHistory(record.id, request);
return new HttpSuccess();
}