no message

This commit is contained in:
kittapath 2024-10-18 11:04:46 +07:00
parent ce5c56bfca
commit 6b5a47213c

View file

@ -263,26 +263,31 @@ export class WorkflowController extends Controller {
},
relations: ["workflow"],
});
if (!stateOperatorUser)
throw new HttpError(HttpStatus.NOT_FOUND, "ผู้ใช้งานนี้ไม่มีหน้าที่ในกระบวนการนี้");
const workflow = await this.workflowRepo.findOne({
where: {
refId: body.refId,
sysName: body.system,
},
});
if (!workflow) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่สามารถดำเนินการกระบวนการนี้ได้");
const operator = await this.stateOperatorRepo.findOne({
where: {
operator: stateOperatorUser.operator,
stateId: stateOperatorUser.workflow.stateId,
operator: stateOperatorUser?.operator || "",
stateId: workflow.stateId,
},
relations: ["state"],
});
if (!operator) {
const state = await this.stateRepo.findOne({
where: {
id: stateOperatorUser.workflow.stateId,
id: workflow.stateId,
},
});
return new HttpSuccess({
stateId: state?.id || null,
stateNo: state?.order || null,
stateName: state?.name || null,
operator: stateOperatorUser.operator,
operator: stateOperatorUser?.operator || null,
can_view: false,
can_update: false,
can_operate: false,
@ -333,6 +338,7 @@ export class WorkflowController extends Controller {
prefix: x.profile.prefix,
firstName: x.profile.firstName,
lastName: x.profile.lastName,
isComment: x.profile.keycloak == req.user.sub ? true : false,
profileId: x.profileId,
isAcceptSetting: x.isAcceptSetting,
isApproveSetting: x.isApproveSetting,