พบเลขบัตรให้ 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,
@Body() body: CreateProfileAllFields,
) {
if (await this.profileRepo.findOneBy({ citizenId: body.citizenId })) {
throw new HttpError(
HttpStatus.INTERNAL_SERVER_ERROR,
"เลขประจำตัวประชาชนนี้มีอยู่ในระบบแล้ว",
);
const profileExist = await this.profileRepo.findOneBy({ citizenId: body.citizenId })
if (profileExist) {
return new HttpSuccess(profileExist.id);
}
if (body.posLevelId === "") body.posLevelId = null;

View file

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