Merge branch 'develop' of github.com:Frappet/hrms-api-org into develop
This commit is contained in:
commit
6d31b84a2c
3 changed files with 30 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,6 +76,8 @@ async function logMiddleware(req: Request, res: Response, next: NextFunction) {
|
|||
if (req.url.startsWith("/api/v1/org/apiKey/")) system = "admin";
|
||||
if (req.url.startsWith("/api/v1/org/api-manage/")) system = "admin";
|
||||
|
||||
if (req.url.startsWith("/api/v1/org/keycloak/")) system = "registry";
|
||||
|
||||
const level = LOG_LEVEL_MAP[process.env.LOG_LEVEL ?? "debug"] || 4;
|
||||
const profileByKeycloak = await repoProfile.findOne({
|
||||
where: { keycloak: req.app.locals.logData.userId },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue