check state
This commit is contained in:
parent
9370c9e72b
commit
5947b19f9e
1 changed files with 19 additions and 4 deletions
|
|
@ -265,8 +265,6 @@ export class WorkflowController extends Controller {
|
||||||
});
|
});
|
||||||
if (!stateOperatorUser)
|
if (!stateOperatorUser)
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ผู้ใช้งานนี้ไม่มีหน้าที่ในกระบวนการนี้");
|
throw new HttpError(HttpStatus.NOT_FOUND, "ผู้ใช้งานนี้ไม่มีหน้าที่ในกระบวนการนี้");
|
||||||
console.log(stateOperatorUser.operator);
|
|
||||||
console.log(stateOperatorUser.workflow.stateId);
|
|
||||||
const operator = await this.stateOperatorRepo.findOne({
|
const operator = await this.stateOperatorRepo.findOne({
|
||||||
where: {
|
where: {
|
||||||
operator: stateOperatorUser.operator,
|
operator: stateOperatorUser.operator,
|
||||||
|
|
@ -274,8 +272,25 @@ export class WorkflowController extends Controller {
|
||||||
},
|
},
|
||||||
relations: ["state"],
|
relations: ["state"],
|
||||||
});
|
});
|
||||||
if (!operator)
|
if (!operator) {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ผู้ใช้งานนี้ไม่มีหน้าที่ในขั้นตอนนี้");
|
const state = await this.stateRepo.findOne({
|
||||||
|
where: {
|
||||||
|
id: stateOperatorUser.workflow.stateId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return new HttpSuccess({
|
||||||
|
stateId: state?.id || null,
|
||||||
|
stateNo: state?.order || null,
|
||||||
|
stateName: state?.name || null,
|
||||||
|
operator: stateOperatorUser.operator,
|
||||||
|
can_view: false,
|
||||||
|
can_update: false,
|
||||||
|
can_operate: false,
|
||||||
|
can_change_state: false,
|
||||||
|
can_delete: false,
|
||||||
|
can_cancel: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
return new HttpSuccess({
|
return new HttpSuccess({
|
||||||
stateId: operator.state.id,
|
stateId: operator.state.id,
|
||||||
stateNo: operator.state.order,
|
stateNo: operator.state.order,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue