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

@ -33,6 +33,29 @@ export class ProfileDisciplineEmployeeController extends Controller {
private disciplineRepository = AppDataSource.getRepository(ProfileDiscipline);
private disciplineHistoryRepository = AppDataSource.getRepository(ProfileDisciplineHistory);
@Get("user")
public async getDisciplineUser(@Request() request: { user: Record<string, any> }) {
const profile = await this.profileRepository.findOneBy({ keycloak: request.user.sub });
if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const lists = await this.disciplineRepository.find({
where: { profileEmployeeId: profile.id },
select: [
"id",
"date",
"level",
"detail",
"unStigma",
"refCommandNo",
"refCommandDate",
"lastUpdateFullName",
"lastUpdatedAt",
],
});
return new HttpSuccess(lists);
}
@Get("{profileId}")
@Example({
status: 200,