พบเลขบัตรให้ return id

This commit is contained in:
Bright 2024-05-07 14:49:39 +07:00
parent c9a8f9dc4d
commit e5f71ba90d
2 changed files with 29 additions and 31 deletions

View file

@ -216,11 +216,9 @@ export class ProfileController extends Controller {
@Request() request: RequestWithUser, @Request() request: RequestWithUser,
@Body() body: CreateProfileAllFields, @Body() body: CreateProfileAllFields,
) { ) {
if (await this.profileRepo.findOneBy({ citizenId: body.citizenId })) { const profileExist = await this.profileRepo.findOneBy({ citizenId: body.citizenId })
throw new HttpError( if (profileExist) {
HttpStatus.INTERNAL_SERVER_ERROR, return new HttpSuccess(profileExist.id);
"เลขประจำตัวประชาชนนี้มีอยู่ในระบบแล้ว",
);
} }
if (body.posLevelId === "") body.posLevelId = null; if (body.posLevelId === "") body.posLevelId = null;

View file

@ -564,43 +564,43 @@ export class CreateProfile {
} }
export class CreateProfileAllFields { export class CreateProfileAllFields {
rank: string; rank: string | null;
prefix: string; prefix: string;
firstName: string; firstName: string;
lastName: string; lastName: string;
citizenId: string; citizenId: string;
position: string; position: string | null;
posLevelId: string | null; posLevelId: string | null;
posTypeId: string | null; posTypeId: string | null;
email: string; email: string | null;
phone: string; phone: string | null;
keycloak: string; keycloak: string | null;
isProbation: boolean; isProbation: boolean | null;
isLeave : boolean; isLeave : boolean | null;
dateRetire : Date | null; dateRetire : Date | null;
dateAppoint : Date | null; dateAppoint : Date | null;
dateStart: Date | null; dateStart: Date | null;
govAgeAbsent: number; govAgeAbsent: number | null;
govAgePlus: number; govAgePlus: number | null;
birthDate: Date | null; birthDate: Date | null;
reasonSameDate : Date | null; reasonSameDate : Date | null;
ethnicity : string; ethnicity : string | null;
telephoneNumber : string; telephoneNumber : string | null;
nationality : string; nationality : string | null;
gender : string; gender : string | null;
relationship : string; relationship : string | null;
religion : string; religion : string | null;
bloodGroup : string; bloodGroup : string | null;
registrationAddress : string; registrationAddress : string | null;
registrationProvinceId : string; registrationProvinceId : string | null;
registrationDistrictId: string; registrationDistrictId: string | null;
registrationSubDistrictId : string; registrationSubDistrictId : string | null;
registrationZipCode : string; registrationZipCode : string | null;
currentAddress : string; currentAddress : string | null;
currentProvinceId : string; currentProvinceId : string | null;
currentDistrictId : string; currentDistrictId : string | null;
currentSubDistrictId : string; currentSubDistrictId : string | null;
currentZipCode : string; currentZipCode : string | null;
}; };
export type UpdateProfile = { export type UpdateProfile = {