fix role ทะเบียนประวัติ

This commit is contained in:
AdisakKanthawilang 2024-09-05 11:57:38 +07:00
parent ccd544b8d5
commit 17818f0064
2 changed files with 31 additions and 2 deletions

View file

@ -1382,8 +1382,9 @@ export class OrganizationController extends Controller {
async Edit(
@Path() id: string,
@Body() requestBody: { orgPublishDate: Date },
@Request() request: { user: Record<string, any> },
@Request() request: RequestWithUser,
) {
// await new permission().PermissionUpdate(request, "SYS_ORG");//ไม่แน่ใจOFFปิดไว้ก่อน
const orgRevision = await this.orgRevisionRepository.findOne({
where: {
id: id,

View file

@ -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: [