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

@ -24,7 +24,7 @@ import {
ProfileDiscipline,
UpdateProfileDiscipline,
} from "../entities/ProfileDiscipline";
import permission from "../interfaces/permission";
@Route("api/v1/org/profile/discipline")
@Tags("ProfileDiscipline")
@Security("bearerAuth")
@ -124,6 +124,7 @@ export class ProfileDisciplineController extends Controller {
@Request() req: RequestWithUser,
@Body() body: CreateProfileDiscipline,
) {
await new permission().PermissionCreate(req,"SYS_REGISTRY");
if (!body.profileId) {
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
}
@ -156,6 +157,7 @@ export class ProfileDisciplineController extends Controller {
@Body() body: UpdateProfileDiscipline,
@Path() disciplineId: string,
) {
await new permission().PermissionUpdate(req,"SYS_REGISTRY");
const record = await this.disciplineRepository.findOneBy({ id: disciplineId });
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
@ -177,7 +179,8 @@ export class ProfileDisciplineController extends Controller {
}
@Delete("{disciplineId}")
public async deleteDiscipline(@Path() disciplineId: string) {
public async deleteDiscipline(@Path() disciplineId: string, @Request() req: RequestWithUser) {
await new permission().PermissionDelete(req,"SYS_REGISTRY");
await this.disciplineHistoryRepository.delete({
profileDisciplineId: disciplineId,
});