permission ทะเบียนประวัติขรก.+ลูกจ้าง

This commit is contained in:
Bright 2024-08-08 17:15:21 +07:00
parent be7f719fd5
commit 9f5987d968
44 changed files with 191 additions and 75 deletions

View file

@ -27,6 +27,7 @@ import {
} from "../entities/ProfileChildren";
import { ProfileEmployee } from "../entities/ProfileEmployee";
import Extension from "../interfaces/extension";
import permission from "../interfaces/permission";
@Route("api/v1/org/profile-employee/family/children")
@Tags("ProfileChildren")
@Security("bearerAuth")
@ -69,6 +70,7 @@ export class ProfileChildrenEmployeeController extends Controller {
@Request() req: RequestWithUser,
@Body() body: CreateProfileChildrenEmployee,
) {
await new permission().PermissionCreate(req,"SYS_REGISTRY_EMP");
const profile = await this.profileRepository.findOneBy({ id: body.profileEmployeeId });
if (!profile) {
@ -113,6 +115,7 @@ export class ProfileChildrenEmployeeController extends Controller {
@Body() body: UpdateProfileChildren,
@Path() childrenId: string,
) {
await new permission().PermissionUpdate(req,"SYS_REGISTRY_EMP");
const record = await this.childrenRepository.findOneBy({ id: childrenId });
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
@ -141,7 +144,8 @@ export class ProfileChildrenEmployeeController extends Controller {
}
@Delete("{childrenId}")
public async deleteTraning(@Path() childrenId: string) {
public async deleteTraning(@Path() childrenId: string, @Request() req: RequestWithUser) {
await new permission().PermissionDelete(req,"SYS_REGISTRY_EMP");
await this.childrenHistoryRepository.delete({
profileChildrenId: childrenId,
});