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