role โครงสร้างอัตรากำลัง

This commit is contained in:
AdisakKanthawilang 2024-08-16 17:36:08 +07:00
parent deb8194b7f
commit 2ce5138a4f
9 changed files with 109 additions and 48 deletions

View file

@ -66,6 +66,7 @@ import { EmployeePosition } from "../entities/EmployeePosition";
import { ProfileInsignia } from "../entities/ProfileInsignia";
import { ProfileLeave } from "../entities/ProfileLeave";
import permission from "../interfaces/permission";
import { request } from "axios";
@Route("api/v1/org/profile-employee")
@Tags("ProfileEmployee")
@Security("bearerAuth")
@ -2029,6 +2030,7 @@ export class ProfileEmployeeController extends Controller {
@Path() id: string,
@Body() body: UpdatePositionTempProfileEmployee,
) {
await new permission().PermissionCreate(request, "SYS_REGISTRY_TEMP");
if (body.posLevelId === "") body.posLevelId = null;
if (body.posTypeId === "") body.posTypeId = null;
@ -2841,6 +2843,7 @@ export class ProfileEmployeeController extends Controller {
@Path() profileEmployeeId: string,
@Body() body: UpdateInformationProfileEmployee,
) {
await new permission().PermissionUpdate(request, "SYS_REGISTRY_TEMP");
const profileEmp = await this.profileRepo.findOneBy({ id: profileEmployeeId });
if (!profileEmp) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
@ -3030,7 +3033,8 @@ export class ProfileEmployeeController extends Controller {
* @param {string} id Id
*/
@Delete("employment/{id}")
async DeleteEmployment(@Path() id: string) {
async DeleteEmployment(@Path() id: string, @Request() request: RequestWithUser) {
await new permission().PermissionDelete(request, "SYS_REGISTRY_TEMP");
await this.employmentHistoryRepository.delete({
profileEmployeeEmploymentId: id,
});
@ -3055,6 +3059,7 @@ export class ProfileEmployeeController extends Controller {
@Path() id: string,
@Body() body: UpdateEmploymentProfileEmployee,
) {
await new permission().PermissionUpdate(request, "SYS_REGISTRY_TEMP");
const employment = await this.employmentRepository.findOneBy({ id });
if (!employment) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");