get ข้อมูล by keycloak (ลูกจ้าง)
This commit is contained in:
parent
24c5cbef55
commit
58fe2f08fd
21 changed files with 423 additions and 3 deletions
|
|
@ -34,6 +34,19 @@ export class ProfileSalaryEmployeeController extends Controller {
|
|||
private salaryRepo = AppDataSource.getRepository(ProfileSalary);
|
||||
private salaryHistoryRepo = AppDataSource.getRepository(ProfileSalaryHistory);
|
||||
|
||||
@Get("user")
|
||||
public async getSalaryUser(@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 record = await this.salaryRepo.find({
|
||||
where: { profileEmployeeId: profile.id },
|
||||
order: { order: "ASC" },
|
||||
});
|
||||
return new HttpSuccess(record);
|
||||
}
|
||||
|
||||
@Get("{profileId}")
|
||||
public async getSalaryEmployee(@Path() profileId: string) {
|
||||
const record = await this.salaryRepo.find({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue