Merge branch 'develop' into dev
All checks were successful
Build & Deploy on Dev / build (push) Successful in 59s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 59s
This commit is contained in:
commit
f4e8f3f28b
2 changed files with 28 additions and 5 deletions
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue