permission ทะเบียนประวัติขรก.+ลูกจ้าง
This commit is contained in:
parent
be7f719fd5
commit
9f5987d968
44 changed files with 191 additions and 75 deletions
|
|
@ -24,7 +24,7 @@ import {
|
|||
ProfileOther,
|
||||
UpdateProfileOther,
|
||||
} from "../entities/ProfileOther";
|
||||
|
||||
import permission from "../interfaces/permission";
|
||||
@Route("api/v1/org/profile-employee/other")
|
||||
@Tags("ProfileOther")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -64,6 +64,7 @@ export class ProfileOtherEmployeeController extends Controller {
|
|||
|
||||
@Post()
|
||||
public async newOther(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeOther) {
|
||||
await new permission().PermissionCreate(req,"SYS_REGISTRY_EMP");
|
||||
if (!body.profileEmployeeId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
|
@ -96,6 +97,7 @@ export class ProfileOtherEmployeeController extends Controller {
|
|||
@Body() body: UpdateProfileOther,
|
||||
@Path() otherId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req,"SYS_REGISTRY_EMP");
|
||||
const record = await this.otherRepository.findOneBy({ id: otherId });
|
||||
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
@ -117,7 +119,8 @@ export class ProfileOtherEmployeeController extends Controller {
|
|||
}
|
||||
|
||||
@Delete("{otherId}")
|
||||
public async deleteOther(@Path() otherId: string) {
|
||||
public async deleteOther(@Path() otherId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionDelete(req,"SYS_REGISTRY_EMP");
|
||||
await this.otherHistoryRepository.delete({
|
||||
profileOtherId: otherId,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue