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,
|
@Request() req: RequestWithUser,
|
||||||
@Body()
|
@Body()
|
||||||
body: {
|
body: {
|
||||||
workflowId: string;
|
refId: string;
|
||||||
|
system: string;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
const workflow = await this.workflowRepo.findOne({
|
const workflow = await this.workflowRepo.findOne({
|
||||||
where: {
|
where: {
|
||||||
id: body.workflowId,
|
refId: body.refId,
|
||||||
|
system: body.system,
|
||||||
},
|
},
|
||||||
relations: ["stateOperatorUsers"],
|
relations: ["stateOperatorUsers"],
|
||||||
});
|
});
|
||||||
|
|
@ -162,7 +164,8 @@ export class WorkflowController extends Controller {
|
||||||
@Request() req: RequestWithUser,
|
@Request() req: RequestWithUser,
|
||||||
@Body()
|
@Body()
|
||||||
body: {
|
body: {
|
||||||
workflowId: string;
|
refId: string;
|
||||||
|
system: string;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
const profile = await this.profileRepo.findOne({
|
const profile = await this.profileRepo.findOne({
|
||||||
|
|
@ -171,22 +174,22 @@ export class WorkflowController extends Controller {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลผู้ใช้งาน");
|
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({
|
const stateOperatorUser = await this.stateOperatorUserRepo.findOne({
|
||||||
where: {
|
where: {
|
||||||
profileId: profile.id,
|
workflowId: workflow.id,
|
||||||
workflowId: body.workflowId,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (!stateOperatorUser)
|
if (!stateOperatorUser)
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ผู้ใช้งานนี้ไม่มีหน้าที่ในกระบวนการนี้");
|
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({
|
const operator = await this.stateOperatorRepo.findOne({
|
||||||
where: {
|
where: {
|
||||||
operator: stateOperatorUser.operator,
|
operator: stateOperatorUser.operator,
|
||||||
|
|
@ -215,12 +218,21 @@ export class WorkflowController extends Controller {
|
||||||
@Request() req: RequestWithUser,
|
@Request() req: RequestWithUser,
|
||||||
@Body()
|
@Body()
|
||||||
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({
|
const state = await this.stateRepo.find({
|
||||||
where: {
|
where: {
|
||||||
workflowId: body.workflowId,
|
workflowId: workflow.id,
|
||||||
},
|
},
|
||||||
order: { stateUserComments: { order: "ASC" } },
|
order: { stateUserComments: { order: "ASC" } },
|
||||||
relations: ["stateUserComments"],
|
relations: ["stateUserComments"],
|
||||||
|
|
@ -239,12 +251,14 @@ export class WorkflowController extends Controller {
|
||||||
@Request() req: RequestWithUser,
|
@Request() req: RequestWithUser,
|
||||||
@Body()
|
@Body()
|
||||||
body: {
|
body: {
|
||||||
workflowId: string;
|
refId: string;
|
||||||
|
system: string;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
const workflow = await this.workflowRepo.findOne({
|
const workflow = await this.workflowRepo.findOne({
|
||||||
where: {
|
where: {
|
||||||
id: body.workflowId,
|
refId: body.refId,
|
||||||
|
system: body.system,
|
||||||
},
|
},
|
||||||
relations: ["stateOperatorUsers"],
|
relations: ["stateOperatorUsers"],
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,22 @@ import { StateOperatorUser } from "./StateOperatorUser";
|
||||||
|
|
||||||
@Entity("workflow")
|
@Entity("workflow")
|
||||||
export class Workflow extends EntityBase {
|
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({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "ชื่อ flow",
|
comment: "ชื่อ flow",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue