Merge branch 'develop' into dev
All checks were successful
Build & Deploy on Dev / build (push) Successful in 59s

This commit is contained in:
harid 2025-12-17 12:42:52 +07:00
commit f4e8f3f28b
2 changed files with 28 additions and 5 deletions

View file

@ -57,6 +57,23 @@ export class OrganizationDotnetController extends Controller {
private insigniaRepo = AppDataSource.getRepository(ProfileInsignia);
private employeePosDictRepository = AppDataSource.getRepository(EmployeePosDict);
/**
* service call
*
* @summary API
*
*/
@Post("check-citizen")
public async CheckCitizen(
@Body()
body: {
citizenId: string;
},
) {
let citizen = Extension.CheckCitizen(body.citizenId)
return new HttpSuccess(citizen);
}
/**
* 1. API Search Profile
*

View file

@ -251,8 +251,11 @@ class Extension {
public static CheckCitizen(value: string) {
let citizen = value;
if (citizen == null || citizen == "") {
return citizen;
if (citizen == null || citizen == "" || citizen == undefined) {
throw new HttpError(
HttpStatus.NOT_FOUND,
"กรุณากรอกข้อมูลรหัสบัตรประจำตัวประชาชน",
);
}
if (citizen.length !== 13) {
throw new HttpError(
@ -277,9 +280,12 @@ class Extension {
const calStp2 = cal % 11;
const chkDigit = (11 - calStp2) % 10;
// if (citizenIdDigits[12] !== chkDigit) {
// throw new HttpError(HttpStatus.NOT_FOUND, "ข้อมูลรหัสบัตรประจำตัวประชาชนไม่ถูกต้อง");
// }
if (citizenIdDigits[12] !== chkDigit) {
throw new HttpError(
HttpStatus.NOT_FOUND,
"ข้อมูลรหัสบัตรประจำตัวประชาชนไม่ถูกต้อง"
);
}
return citizen;
}