get ข้อมูล by keycloak (ลูกจ้าง)

This commit is contained in:
Bright 2024-05-23 18:30:16 +07:00
parent 24c5cbef55
commit 58fe2f08fd
21 changed files with 423 additions and 3 deletions

View file

@ -29,6 +29,30 @@ export class ProfileFamilyMotherEmployeeController extends Controller {
private ProfileFamilyMother = AppDataSource.getRepository(ProfileFamilyMother);
private ProfileFamilyMotherHistory = AppDataSource.getRepository(ProfileFamilyMotherHistory);
@Get("user")
public async getFamilyMotherUser(@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 familyMother = await this.ProfileFamilyMother.findOne({
select: [
"id",
"motherPrefix",
"motherFirstName",
"motherLastName",
"motherCareer",
"motherCitizenId",
"motherLive",
"profileId",
],
where: { profileEmployeeId: profile.id },
order: { lastUpdatedAt: "DESC" },
});
return new HttpSuccess(familyMother);
}
@Get("{profileEmployeeId}")
@Example({
status: 200,