changName update and validate citizenId

This commit is contained in:
AdisakKanthawilang 2024-05-14 17:24:33 +07:00
parent f1a8652587
commit 9506128842
4 changed files with 54 additions and 2 deletions

View file

@ -195,6 +195,10 @@ export class ProfileController extends Controller {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลประเภทตำแหน่งนี้");
}
if (body.citizenId && (await this.profileRepo.findOneBy({ citizenId: body.citizenId }))) {
throw new HttpError(HttpStatus.NOT_FOUND, "ข้อมูลรหัสบัตรประจำตัวประชาชนนี้มีอยู่ในระบบแล้ว");
}
const profile = Object.assign(new Profile(), body);
profile.isProbation = false;
profile.isLeave = false;