add parth admin history

This commit is contained in:
AdisakKanthawilang 2024-09-09 18:10:01 +07:00
parent 74e64176e6
commit 4b6fd79264
23 changed files with 309 additions and 50 deletions

View file

@ -70,8 +70,8 @@ export class ProfileLeaveEmployeeTempController extends Controller {
return new HttpSuccess(record);
}
@Get("history/{leaveId}")
public async leaveHistory(@Path() leaveId: string, @Request() req: RequestWithUser) {
@Get("admin/history/{leaveId}")
public async leaveAdminHistory(@Path() leaveId: string, @Request() req: RequestWithUser) {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.leaveHistoryRepo.find({
relations: { leaveType: true },
@ -81,6 +81,16 @@ export class ProfileLeaveEmployeeTempController extends Controller {
return new HttpSuccess(record);
}
@Get("history/{leaveId}")
public async leaveHistory(@Path() leaveId: string) {
const record = await this.leaveHistoryRepo.find({
relations: { leaveType: true },
where: { profileLeaveId: leaveId },
order: { createdAt: "DESC" },
});
return new HttpSuccess(record);
}
@Post()
public async newLeave(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeLeave) {
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");