diff --git a/src/controllers/OrganizationController.ts b/src/controllers/OrganizationController.ts index a154328a..ecc18656 100644 --- a/src/controllers/OrganizationController.ts +++ b/src/controllers/OrganizationController.ts @@ -1382,8 +1382,9 @@ export class OrganizationController extends Controller { async Edit( @Path() id: string, @Body() requestBody: { orgPublishDate: Date }, - @Request() request: { user: Record }, + @Request() request: RequestWithUser, ) { + // await new permission().PermissionUpdate(request, "SYS_ORG");//ไม่แน่ใจOFFปิดไว้ก่อน const orgRevision = await this.orgRevisionRepository.findOne({ where: { id: id, diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index 35b1263f..f33dabe3 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -1584,7 +1584,8 @@ export class PositionController extends Controller { * @param {string} id Id อัตรากำลัง */ @Get("history/{id}") - async getHistoryPosMater(@Path() id: string) { + async getHistoryPosMater(@Path() id: string , @Request() request: RequestWithUser) { + await new permission().PermissionGet(request , "SYS_ORG"); const posMaster = await this.posMasterRepository.findOne({ where: { id }, }); @@ -3313,12 +3314,25 @@ export class PositionController extends Controller { */ @Post("act/search") async searchAct( + @Request() request: RequestWithUser, @Body() body: { posmasterId: string; isAll: boolean; }, ) { + // let _data = { + // root: null, + // child1: null, + // child2: null, + // child3: null, + // child4: null, + // } + + // if (!request.user.role.includes("SUPER_ADMIN")) { + // _data = await new permission().PermissionOrgList(request, "SYS_ORG"); + // } + const posMasterMain = await this.posMasterRepository.findOne({ where: { id: body.posmasterId }, relations: ["posMasterActs"], @@ -3349,7 +3363,21 @@ export class PositionController extends Controller { current_holderId: Not(IsNull()), id: Not(In(posId)), }; + // console.log("ddddd",_data); + + // typeCondition = { + // orgRoot: _data.root && _data.root[0] ? { id: In(_data.root) } : { id: IsNull() }, + // orgChild1: _data.child1 && _data.child1[0] ? { id: In(_data.child1) } : { id: IsNull() }, + // orgChild2: _data.child2 && _data.child2[0] ? { id: In(_data.child2) } : { id: IsNull() }, + // orgChild3: _data.child3 && _data.child3[0] ? { id: In(_data.child3) } : { id: IsNull() }, + // orgChild4: _data.child4 && _data.child4[0] ? { id: In(_data.child4) } : { id: IsNull() }, + // current_holderId: Not(IsNull()), + // id: Not(In(posId)), + // }; } + + // console.log("typeCondition>>>",typeCondition); + const posMaster = await this.posMasterRepository.find({ where: typeCondition, relations: [