แก้ workflow profileid null
This commit is contained in:
parent
158eab7683
commit
c9b54f195a
1 changed files with 33 additions and 29 deletions
|
|
@ -127,15 +127,17 @@ export class WorkflowController extends Controller {
|
|||
);
|
||||
|
||||
const stateOperatorUser = new StateOperatorUser();
|
||||
Object.assign(stateOperatorUser, {
|
||||
profileId: profileType == "OFFICER" ? profile.id : null,
|
||||
profileEmployeeId: profileType != "OFFICER" ? profile.id : null,
|
||||
profileType: profileType,
|
||||
operator: "Owner",
|
||||
order: 1,
|
||||
workflowId: workflow.id,
|
||||
...meta,
|
||||
});
|
||||
if (profile) {
|
||||
Object.assign(stateOperatorUser, {
|
||||
profileId: profileType == "OFFICER" ? profile.id : null,
|
||||
profileEmployeeId: profileType != "OFFICER" ? profile.id : null,
|
||||
profileType: profileType,
|
||||
operator: "Owner",
|
||||
order: 1,
|
||||
workflowId: workflow.id,
|
||||
...meta,
|
||||
});
|
||||
}
|
||||
await this.stateOperatorUserRepo.save(stateOperatorUser);
|
||||
|
||||
const profileOfficer = await this.posMasterRepo.find({
|
||||
|
|
@ -147,26 +149,28 @@ export class WorkflowController extends Controller {
|
|||
});
|
||||
await Promise.all(
|
||||
profileOfficer.map(async (item, i) => {
|
||||
if (item.orgChild1 == null || item.orgChild1.isOfficer == false) {
|
||||
const stateOperatorUser = new StateOperatorUser();
|
||||
Object.assign(stateOperatorUser, {
|
||||
profileId: item.current_holderId,
|
||||
operator: "Officer",
|
||||
order: i + 2,
|
||||
workflowId: workflow.id,
|
||||
...meta,
|
||||
});
|
||||
await this.stateOperatorUserRepo.save(stateOperatorUser);
|
||||
} else {
|
||||
const stateOperatorUser = new StateOperatorUser();
|
||||
Object.assign(stateOperatorUser, {
|
||||
profileId: item.current_holderId,
|
||||
operator: "PersonnelOfficer",
|
||||
order: i + 2,
|
||||
workflowId: workflow.id,
|
||||
...meta,
|
||||
});
|
||||
await this.stateOperatorUserRepo.save(stateOperatorUser);
|
||||
if (item.current_holderId) {
|
||||
if (item.orgChild1 == null || item.orgChild1.isOfficer == false) {
|
||||
const stateOperatorUser = new StateOperatorUser();
|
||||
Object.assign(stateOperatorUser, {
|
||||
profileId: item.current_holderId,
|
||||
operator: "Officer",
|
||||
order: i + 2,
|
||||
workflowId: workflow.id,
|
||||
...meta,
|
||||
});
|
||||
await this.stateOperatorUserRepo.save(stateOperatorUser);
|
||||
} else {
|
||||
const stateOperatorUser = new StateOperatorUser();
|
||||
Object.assign(stateOperatorUser, {
|
||||
profileId: item.current_holderId,
|
||||
operator: "PersonnelOfficer",
|
||||
order: i + 2,
|
||||
workflowId: workflow.id,
|
||||
...meta,
|
||||
});
|
||||
await this.stateOperatorUserRepo.save(stateOperatorUser);
|
||||
}
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue