diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index d2c87cf1..f9da44c6 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -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,