no message
This commit is contained in:
parent
3ea2c7c3b0
commit
f67dab02a0
2 changed files with 46 additions and 16 deletions
|
|
@ -132,12 +132,14 @@ export class WorkflowController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body()
|
||||
body: {
|
||||
workflowId: string;
|
||||
refId: string;
|
||||
system: string;
|
||||
},
|
||||
) {
|
||||
const workflow = await this.workflowRepo.findOne({
|
||||
where: {
|
||||
id: body.workflowId,
|
||||
refId: body.refId,
|
||||
system: body.system,
|
||||
},
|
||||
relations: ["stateOperatorUsers"],
|
||||
});
|
||||
|
|
@ -162,7 +164,8 @@ export class WorkflowController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body()
|
||||
body: {
|
||||
workflowId: string;
|
||||
refId: string;
|
||||
system: string;
|
||||
},
|
||||
) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
|
|
@ -171,22 +174,22 @@ export class WorkflowController extends Controller {
|
|||
},
|
||||
});
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลผู้ใช้งาน");
|
||||
const workflow = await this.workflowRepo.findOne({
|
||||
where: {
|
||||
refId: body.refId,
|
||||
system: body.system,
|
||||
},
|
||||
relations: ["stateOperatorUsers"],
|
||||
});
|
||||
if (!workflow) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่สามารถดำเนินการกระบวนการนี้ได้");
|
||||
const stateOperatorUser = await this.stateOperatorUserRepo.findOne({
|
||||
where: {
|
||||
profileId: profile.id,
|
||||
workflowId: body.workflowId,
|
||||
workflowId: workflow.id,
|
||||
},
|
||||
});
|
||||
if (!stateOperatorUser)
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ผู้ใช้งานนี้ไม่มีหน้าที่ในกระบวนการนี้");
|
||||
|
||||
const workflow = await this.workflowRepo.findOne({
|
||||
where: {
|
||||
id: body.workflowId,
|
||||
},
|
||||
});
|
||||
if (!workflow) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่สามารถดำเนินการกระบวนการนี้ได้");
|
||||
|
||||
const operator = await this.stateOperatorRepo.findOne({
|
||||
where: {
|
||||
operator: stateOperatorUser.operator,
|
||||
|
|
@ -215,12 +218,21 @@ export class WorkflowController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body()
|
||||
body: {
|
||||
workflowId: string;
|
||||
refId: string;
|
||||
system: string;
|
||||
},
|
||||
) {
|
||||
const workflow = await this.workflowRepo.findOne({
|
||||
where: {
|
||||
refId: body.refId,
|
||||
system: body.system,
|
||||
},
|
||||
relations: ["stateOperatorUsers"],
|
||||
});
|
||||
if (!workflow) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่สามารถดำเนินการกระบวนการนี้ได้");
|
||||
const state = await this.stateRepo.find({
|
||||
where: {
|
||||
workflowId: body.workflowId,
|
||||
workflowId: workflow.id,
|
||||
},
|
||||
order: { stateUserComments: { order: "ASC" } },
|
||||
relations: ["stateUserComments"],
|
||||
|
|
@ -239,12 +251,14 @@ export class WorkflowController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body()
|
||||
body: {
|
||||
workflowId: string;
|
||||
refId: string;
|
||||
system: string;
|
||||
},
|
||||
) {
|
||||
const workflow = await this.workflowRepo.findOne({
|
||||
where: {
|
||||
id: body.workflowId,
|
||||
refId: body.refId,
|
||||
system: body.system,
|
||||
},
|
||||
relations: ["stateOperatorUsers"],
|
||||
});
|
||||
|
|
|
|||
|
|
@ -5,6 +5,22 @@ import { StateOperatorUser } from "./StateOperatorUser";
|
|||
|
||||
@Entity("workflow")
|
||||
export class Workflow extends EntityBase {
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "refIdw",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
refId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "system",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
system: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ชื่อ flow",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue