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

@ -26,7 +26,7 @@ import {
UpdateProfileChangeName,
} from "../entities/ProfileChangeName";
import { ProfileEmployee } from "../entities/ProfileEmployee";
import permission from "../interfaces/permission";
@Route("api/v1/org/profile-employee/changeName")
@Tags("ProfileChangeNameEmployee")
@Security("bearerAuth")
@ -119,6 +119,7 @@ export class ProfileChangeNameEmployeeController extends Controller {
@Request() req: RequestWithUser,
@Body() body: CreateProfileChangeNameEmployee,
) {
await new permission().PermissionCreate(req,"SYS_REGISTRY_EMP");
if (!body.profileEmployeeId) {
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId");
}
@ -156,6 +157,7 @@ export class ProfileChangeNameEmployeeController extends Controller {
@Body() body: UpdateProfileChangeName,
@Path() changeNameId: string,
) {
await new permission().PermissionUpdate(req,"SYS_REGISTRY_EMP");
const record = await this.changeNameRepository.findOneBy({ id: changeNameId });
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
@ -196,7 +198,8 @@ export class ProfileChangeNameEmployeeController extends Controller {
}
@Delete("{changeNameId}")
public async deleteTraning(@Path() changeNameId: string) {
public async deleteTraning(@Path() changeNameId: string, @Request() req: RequestWithUser) {
await new permission().PermissionDelete(req,"SYS_REGISTRY_EMP");
await this.changeNameHistoryRepository.delete({
profileChangeNameId: changeNameId,
});