get ข้อมูล by keycloak (ลูกจ้าง)
This commit is contained in:
parent
24c5cbef55
commit
58fe2f08fd
21 changed files with 423 additions and 3 deletions
|
|
@ -35,6 +35,34 @@ export class ProfileAddressEmployeeController extends Controller {
|
|||
private profileEmployeeRepo = AppDataSource.getRepository(ProfileEmployee);
|
||||
private profileAddressHistoryRepo = AppDataSource.getRepository(ProfileAddressHistory);
|
||||
|
||||
@Get("user")
|
||||
public async detailProfileAddressUser(@Request() request: { user: Record<string, any> }) {
|
||||
const profile = await this.profileEmployeeRepo.findOneBy({ keycloak: request.user.sub });
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
const getProfileAddress = await this.profileEmployeeRepo.findOne({
|
||||
where: { id: profile.id },
|
||||
select: [
|
||||
"id",
|
||||
"registrationAddress",
|
||||
"registrationProvinceId",
|
||||
"registrationDistrictId",
|
||||
"registrationSubDistrictId",
|
||||
"registrationZipCode",
|
||||
"currentAddress",
|
||||
"currentProvinceId",
|
||||
"currentDistrictId",
|
||||
"currentSubDistrictId",
|
||||
"currentZipCode",
|
||||
],
|
||||
});
|
||||
if (!getProfileAddress) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
return new HttpSuccess(getProfileAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary ข้อมูลที่อยู่
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue