list รายชื่อ workflow

This commit is contained in:
kittapath 2025-03-18 15:14:27 +07:00
parent 0b5fae46cf
commit e570339e1a

View file

@ -800,27 +800,28 @@ export class WorkflowController extends Controller {
keyword: string; keyword: string;
page: number; page: number;
pageSize: number; pageSize: number;
profileId?: string | null;
}, },
) { ) {
let userId = ""; let posMasterUser: PosMaster = new PosMaster();
// if (xxx) { if (body.profileId) {
// } else { posMasterUser = (await this.posMasterRepo.findOne({
// const posMasterUser = await this.posMasterRepo.findOne({ where: {
// where: { orgRevision: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
// orgRevision: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false }, current_holderId: body.profileId,
// current_holder: { keycloak: request.user.sub }, },
// }, relations: ["current_holder", "current_holder.posType", "current_holder.posLevel"],
// relations: ["current_holder", "current_holder.posType", "current_holder.posLevel"], })) as PosMaster;
// }); } else {
// } posMasterUser = (await this.posMasterRepo.findOne({
where: {
orgRevision: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
current_holder: { keycloak: request.user.sub },
},
relations: ["current_holder", "current_holder.posType", "current_holder.posLevel"],
})) as PosMaster;
}
const posMasterUser = await this.posMasterRepo.findOne({
where: {
orgRevision: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
current_holder: { keycloak: request.user.sub },
},
relations: ["current_holder", "current_holder.posType", "current_holder.posLevel"],
});
if (!posMasterUser || !posMasterUser.orgRootId) if (!posMasterUser || !posMasterUser.orgRootId)
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบตำแหน่งผู้ใช้งาน"); throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบตำแหน่งผู้ใช้งาน");
@ -846,10 +847,15 @@ export class WorkflowController extends Controller {
// orgChild3Id: IsNull(), // orgChild3Id: IsNull(),
// orgChild4Id: IsNull(), // orgChild4Id: IsNull(),
}; };
condition.orgChild1Id = IsNull(); if (posMasterUser.orgChild4Id == null) {
condition.orgChild2Id = IsNull(); condition.orgChild4Id = IsNull();
condition.orgChild3Id = IsNull(); } else if (posMasterUser.orgChild3Id == null) {
condition.orgChild4Id = IsNull(); condition.orgChild3Id = IsNull();
} else if (posMasterUser.orgChild2Id == null) {
condition.orgChild2Id = IsNull();
} else if (posMasterUser.orgChild1Id == null) {
condition.orgChild1Id = IsNull();
}
} else { } else {
if ( if (
(posMasterUser.current_holder.posType.posTypeName == "ทั่วไป" && (posMasterUser.current_holder.posType.posTypeName == "ทั่วไป" &&