เพิ่มsearch avatar

This commit is contained in:
Kittapath 2024-05-16 13:39:25 +07:00
parent 62166c430e
commit feb8da3947

View file

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