get ข้อมูล by keycloak (ลูกจ้าง)
This commit is contained in:
parent
24c5cbef55
commit
58fe2f08fd
21 changed files with 423 additions and 3 deletions
|
|
@ -29,6 +29,27 @@ export class ProfileDutyEmployeeController extends Controller {
|
|||
private dutyRepository = AppDataSource.getRepository(ProfileDuty);
|
||||
private dutyHistoryRepository = AppDataSource.getRepository(ProfileDutyHistory);
|
||||
|
||||
@Get("user")
|
||||
public async getDutyUser(@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.dutyRepository.find({
|
||||
where: { profileEmployeeId: profile.id },
|
||||
select: [
|
||||
"id",
|
||||
"dateStart",
|
||||
"dateEnd",
|
||||
"reference",
|
||||
"detail",
|
||||
"refCommandNo",
|
||||
"refCommandDate",
|
||||
],
|
||||
});
|
||||
return new HttpSuccess(lists);
|
||||
}
|
||||
|
||||
@Get("{profileId}")
|
||||
public async getDuty(@Path() profileId: string) {
|
||||
const lists = await this.dutyRepository.find({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue