permission ทะเบียนประวัติขรก.+ลูกจ้าง
This commit is contained in:
parent
be7f719fd5
commit
9f5987d968
44 changed files with 191 additions and 75 deletions
|
|
@ -16,11 +16,9 @@ import {
|
|||
Patch,
|
||||
Example,
|
||||
} from "tsoa";
|
||||
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpError from "../interfaces/http-error";
|
||||
import HttpStatus from "../interfaces/http-status";
|
||||
|
||||
import {
|
||||
ProfileEducation,
|
||||
CreateProfileEducation,
|
||||
|
|
@ -32,7 +30,7 @@ import { Profile } from "../entities/Profile";
|
|||
import { ProfileEducationHistory } from "../entities/ProfileEducationHistory";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import { ProfileEmployee } from "../entities/ProfileEmployee";
|
||||
|
||||
import permission from "../interfaces/permission";
|
||||
@Route("api/v1/org/profile-employee/educations")
|
||||
@Tags("ProfileEducationsEmployee")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -185,6 +183,7 @@ export class ProfileEducationsEmployeeController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileEducationEmployee,
|
||||
) {
|
||||
await new permission().PermissionCreate(req,"SYS_REGISTRY_EMP");
|
||||
if (!body.profileEmployeeId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId");
|
||||
}
|
||||
|
|
@ -215,6 +214,7 @@ export class ProfileEducationsEmployeeController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Path() educationId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req,"SYS_REGISTRY_EMP");
|
||||
const record = await this.profileEducationRepo.findOneBy({ id: educationId });
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
|
|
@ -236,7 +236,8 @@ export class ProfileEducationsEmployeeController extends Controller {
|
|||
}
|
||||
|
||||
@Delete("{educationId}")
|
||||
public async deleteProfileEducation(@Path() educationId: string) {
|
||||
public async deleteProfileEducation(@Path() educationId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionDelete(req,"SYS_REGISTRY_EMP");
|
||||
await this.profileEducationHistoryRepo.delete({
|
||||
profileEducationId: educationId,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue