get ข้อมูล by keycloak (ลูกจ้าง)
This commit is contained in:
parent
24c5cbef55
commit
58fe2f08fd
21 changed files with 423 additions and 3 deletions
|
|
@ -29,6 +29,30 @@ export class ProfileFamilyFatherEmployeeController extends Controller {
|
|||
private ProfileFamilyFather = AppDataSource.getRepository(ProfileFamilyFather);
|
||||
private ProfileFamilyFatherHistory = AppDataSource.getRepository(ProfileFamilyFatherHistory);
|
||||
|
||||
@Get("user")
|
||||
public async getFamilyFatherUser(@Request() request: { user: Record<string, any> }) {
|
||||
const profile = await this.profileRepo.findOneBy({ keycloak: request.user.sub });
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
const familyFather = await this.ProfileFamilyFather.findOne({
|
||||
select: [
|
||||
"id",
|
||||
"fatherPrefix",
|
||||
"fatherFirstName",
|
||||
"fatherLastName",
|
||||
"fatherCareer",
|
||||
"fatherCitizenId",
|
||||
"fatherLive",
|
||||
"profileId",
|
||||
],
|
||||
where: { profileEmployeeId: profile.id },
|
||||
order: { lastUpdatedAt: "DESC" },
|
||||
});
|
||||
|
||||
return new HttpSuccess(familyFather);
|
||||
}
|
||||
|
||||
@Get("{profileEmployeeId}")
|
||||
@Example({
|
||||
status: 200,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue