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( async Edit(
@Path() id: string, @Path() id: string,
@Body() requestBody: { orgPublishDate: Date }, @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({ const orgRevision = await this.orgRevisionRepository.findOne({
where: { where: {
id: id, id: id,

View file

@ -1584,7 +1584,8 @@ export class PositionController extends Controller {
* @param {string} id Id * @param {string} id Id
*/ */
@Get("history/{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({ const posMaster = await this.posMasterRepository.findOne({
where: { id }, where: { id },
}); });
@ -3313,12 +3314,25 @@ export class PositionController extends Controller {
*/ */
@Post("act/search") @Post("act/search")
async searchAct( async searchAct(
@Request() request: RequestWithUser,
@Body() @Body()
body: { body: {
posmasterId: string; posmasterId: string;
isAll: boolean; 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({ const posMasterMain = await this.posMasterRepository.findOne({
where: { id: body.posmasterId }, where: { id: body.posmasterId },
relations: ["posMasterActs"], relations: ["posMasterActs"],
@ -3349,7 +3363,21 @@ export class PositionController extends Controller {
current_holderId: Not(IsNull()), current_holderId: Not(IsNull()),
id: Not(In(posId)), 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({ const posMaster = await this.posMasterRepository.find({
where: typeCondition, where: typeCondition,
relations: [ relations: [