get ข้อมูล by keycloak (ลูกจ้าง)
This commit is contained in:
parent
24c5cbef55
commit
58fe2f08fd
21 changed files with 423 additions and 3 deletions
|
|
@ -35,6 +35,23 @@ export class ProfileInsigniaEmployeeController extends Controller {
|
|||
private insigniaHistoryRepo = AppDataSource.getRepository(ProfileInsigniaHistory);
|
||||
private insigniaMetaRepo = AppDataSource.getRepository(Insignia);
|
||||
|
||||
@Get("user")
|
||||
public async getInsigniaUser(@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 record = await this.insigniaRepo.find({
|
||||
relations: {
|
||||
insignia: {
|
||||
insigniaType: true,
|
||||
},
|
||||
},
|
||||
where: { profileEmployeeId: profile.id },
|
||||
});
|
||||
return new HttpSuccess(record);
|
||||
}
|
||||
|
||||
@Get("{profileEmployeeId}")
|
||||
@Example({
|
||||
status: 200,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue