comment workflow
This commit is contained in:
parent
3fc5a73947
commit
6a23f31046
36 changed files with 32 additions and 177 deletions
|
|
@ -546,34 +546,23 @@ export class WorkflowController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body()
|
||||
body: {
|
||||
stateId: string;
|
||||
stateUserCommentId: string;
|
||||
isAccept?: boolean | null;
|
||||
isApprove?: boolean | null;
|
||||
reason?: string | null;
|
||||
},
|
||||
) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
const stateUserComment = await this.stateUserCommentRepo.findOne({
|
||||
where: {
|
||||
keycloak: req.user.sub,
|
||||
id: body.stateUserCommentId,
|
||||
},
|
||||
});
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลผู้ใช้งาน");
|
||||
const state = await this.stateRepo.findOne({
|
||||
where: {
|
||||
id: body.stateId,
|
||||
},
|
||||
});
|
||||
if (!state) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลขั้นตอนการอนุมัติ");
|
||||
if (!stateUserComment)
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลขั้นตอนการอนุมัติ");
|
||||
let _null: any = null;
|
||||
const stateUserComment = new StateUserComment();
|
||||
stateUserComment.stateId = body.stateId;
|
||||
stateUserComment.profileId = profile.id;
|
||||
stateUserComment.isAccept = body.isAccept == null ? _null : body.isAccept;
|
||||
stateUserComment.isApprove = body.isApprove == null ? _null : body.isAccept;
|
||||
stateUserComment.reason = body.reason == null ? _null : body.isAccept;
|
||||
stateUserComment.createdUserId = req.user.sub;
|
||||
stateUserComment.createdFullName = req.user.name;
|
||||
stateUserComment.createdAt = new Date();
|
||||
stateUserComment.lastUpdateUserId = req.user.sub;
|
||||
stateUserComment.lastUpdateFullName = req.user.name;
|
||||
stateUserComment.lastUpdatedAt = new Date();
|
||||
|
|
@ -620,6 +609,7 @@ export class WorkflowController extends Controller {
|
|||
});
|
||||
|
||||
return new HttpSuccess({
|
||||
id: stateUserComment?.id || null,
|
||||
isAccept: stateUserComment?.isAccept || null,
|
||||
isApprove: stateUserComment?.isApprove || null,
|
||||
reason: stateUserComment?.reason || null,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue