add admin path ทะเบียนประวัติ

This commit is contained in:
AdisakKanthawilang 2024-09-03 15:08:29 +07:00
parent a7c1b2e6a9
commit 4bfecf7899
12 changed files with 205 additions and 52 deletions

View file

@ -146,8 +146,8 @@ export class ProfileLeaveController 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(req, "SYS_REGISTRY_OFFICER", _record.profileId);
@ -160,6 +160,16 @@ export class ProfileLeaveController 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: CreateProfileLeave) {
if (!body.profileId) {