เพิ่มsearch avatar
This commit is contained in:
parent
62166c430e
commit
feb8da3947
1 changed files with 19 additions and 12 deletions
|
|
@ -196,7 +196,10 @@ export class ProfileController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body.citizenId.length !== 13) {
|
if (body.citizenId.length !== 13) {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "กรุณากรอกข้อมูลรหัสบัตรประจำตัวประชาชนให้ครบ 13 หลัก");
|
throw new HttpError(
|
||||||
|
HttpStatus.NOT_FOUND,
|
||||||
|
"กรุณากรอกข้อมูลรหัสบัตรประจำตัวประชาชนให้ครบ 13 หลัก",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body.citizenId) {
|
if (body.citizenId) {
|
||||||
|
|
@ -216,16 +219,16 @@ export class ProfileController extends Controller {
|
||||||
citizenIdDigits[11] * 2;
|
citizenIdDigits[11] * 2;
|
||||||
const calStp2 = cal % 11;
|
const calStp2 = cal % 11;
|
||||||
let chkDigit = 11 - calStp2;
|
let chkDigit = 11 - calStp2;
|
||||||
if(chkDigit === 10){
|
if (chkDigit === 10) {
|
||||||
chkDigit = 1;
|
chkDigit = 1;
|
||||||
}else if(chkDigit === 11){
|
} else if (chkDigit === 11) {
|
||||||
chkDigit = chkDigit % 10;
|
chkDigit = chkDigit % 10;
|
||||||
}
|
}
|
||||||
// else if(chkDigit === 11){
|
// else if(chkDigit === 11){
|
||||||
// chkDigit = cal % 10;
|
// chkDigit = cal % 10;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if(citizenIdDigits[12] !== chkDigit){
|
if (citizenIdDigits[12] !== chkDigit) {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ข้อมูลรหัสบัตรประจำตัวประชาชนไม่ถูกต้อง");
|
throw new HttpError(HttpStatus.NOT_FOUND, "ข้อมูลรหัสบัตรประจำตัวประชาชนไม่ถูกต้อง");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -245,7 +248,6 @@ export class ProfileController extends Controller {
|
||||||
// profile.dateRetireLaw = calculateRetireDate(profile.birthDate);
|
// profile.dateRetireLaw = calculateRetireDate(profile.birthDate);
|
||||||
await this.profileRepo.save(profile);
|
await this.profileRepo.save(profile);
|
||||||
|
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -331,9 +333,12 @@ export class ProfileController extends Controller {
|
||||||
if (body.posTypeId && !(await this.posTypeRepo.findOneBy({ id: body.posTypeId }))) {
|
if (body.posTypeId && !(await this.posTypeRepo.findOneBy({ id: body.posTypeId }))) {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลประเภทตำแหน่งนี้");
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลประเภทตำแหน่งนี้");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body.citizenId && body.citizenId.length !== 13) {
|
if (body.citizenId && body.citizenId.length !== 13) {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "กรุณากรอกข้อมูลรหัสบัตรประจำตัวประชาชนให้ครบ 13 หลัก");
|
throw new HttpError(
|
||||||
|
HttpStatus.NOT_FOUND,
|
||||||
|
"กรุณากรอกข้อมูลรหัสบัตรประจำตัวประชาชนให้ครบ 13 หลัก",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body.citizenId) {
|
if (body.citizenId) {
|
||||||
|
|
@ -353,16 +358,16 @@ export class ProfileController extends Controller {
|
||||||
citizenIdDigits[11] * 2;
|
citizenIdDigits[11] * 2;
|
||||||
const calStp2 = cal % 11;
|
const calStp2 = cal % 11;
|
||||||
let chkDigit = 11 - calStp2;
|
let chkDigit = 11 - calStp2;
|
||||||
if(chkDigit === 10){
|
if (chkDigit === 10) {
|
||||||
chkDigit = 1;
|
chkDigit = 1;
|
||||||
}else if(chkDigit === 11){
|
} else if (chkDigit === 11) {
|
||||||
chkDigit = chkDigit % 10;
|
chkDigit = chkDigit % 10;
|
||||||
}
|
}
|
||||||
// else if(chkDigit === 11){
|
// else if(chkDigit === 11){
|
||||||
// chkDigit = cal % 10;
|
// chkDigit = cal % 10;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if(citizenIdDigits[12] !== chkDigit){
|
if (citizenIdDigits[12] !== chkDigit) {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ข้อมูลรหัสบัตรประจำตัวประชาชนไม่ถูกต้อง");
|
throw new HttpError(HttpStatus.NOT_FOUND, "ข้อมูลรหัสบัตรประจำตัวประชาชนไม่ถูกต้อง");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -652,6 +657,8 @@ export class ProfileController extends Controller {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: _data.id,
|
id: _data.id,
|
||||||
|
avatar: _data.avatar,
|
||||||
|
avatarName: _data.avatarName,
|
||||||
prefix: _data.prefix,
|
prefix: _data.prefix,
|
||||||
rank: _data.rank,
|
rank: _data.rank,
|
||||||
firstName: _data.firstName,
|
firstName: _data.firstName,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue