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 ProfileLeaveEmployeeController 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) {
const _record = await this.leaveRepo.findOneBy({ id: leaveId });
if (_record) {
await new permission().PermissionOrgUserGet(
@ -88,6 +88,16 @@ export class ProfileLeaveEmployeeController 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) {
if (!body.profileEmployeeId) {