แก้ 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();
|
const stateOperatorUser = new StateOperatorUser();
|
||||||
Object.assign(stateOperatorUser, {
|
if (profile) {
|
||||||
profileId: profileType == "OFFICER" ? profile.id : null,
|
Object.assign(stateOperatorUser, {
|
||||||
profileEmployeeId: profileType != "OFFICER" ? profile.id : null,
|
profileId: profileType == "OFFICER" ? profile.id : null,
|
||||||
profileType: profileType,
|
profileEmployeeId: profileType != "OFFICER" ? profile.id : null,
|
||||||
operator: "Owner",
|
profileType: profileType,
|
||||||
order: 1,
|
operator: "Owner",
|
||||||
workflowId: workflow.id,
|
order: 1,
|
||||||
...meta,
|
workflowId: workflow.id,
|
||||||
});
|
...meta,
|
||||||
|
});
|
||||||
|
}
|
||||||
await this.stateOperatorUserRepo.save(stateOperatorUser);
|
await this.stateOperatorUserRepo.save(stateOperatorUser);
|
||||||
|
|
||||||
const profileOfficer = await this.posMasterRepo.find({
|
const profileOfficer = await this.posMasterRepo.find({
|
||||||
|
|
@ -147,26 +149,28 @@ export class WorkflowController extends Controller {
|
||||||
});
|
});
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
profileOfficer.map(async (item, i) => {
|
profileOfficer.map(async (item, i) => {
|
||||||
if (item.orgChild1 == null || item.orgChild1.isOfficer == false) {
|
if (item.current_holderId) {
|
||||||
const stateOperatorUser = new StateOperatorUser();
|
if (item.orgChild1 == null || item.orgChild1.isOfficer == false) {
|
||||||
Object.assign(stateOperatorUser, {
|
const stateOperatorUser = new StateOperatorUser();
|
||||||
profileId: item.current_holderId,
|
Object.assign(stateOperatorUser, {
|
||||||
operator: "Officer",
|
profileId: item.current_holderId,
|
||||||
order: i + 2,
|
operator: "Officer",
|
||||||
workflowId: workflow.id,
|
order: i + 2,
|
||||||
...meta,
|
workflowId: workflow.id,
|
||||||
});
|
...meta,
|
||||||
await this.stateOperatorUserRepo.save(stateOperatorUser);
|
});
|
||||||
} else {
|
await this.stateOperatorUserRepo.save(stateOperatorUser);
|
||||||
const stateOperatorUser = new StateOperatorUser();
|
} else {
|
||||||
Object.assign(stateOperatorUser, {
|
const stateOperatorUser = new StateOperatorUser();
|
||||||
profileId: item.current_holderId,
|
Object.assign(stateOperatorUser, {
|
||||||
operator: "PersonnelOfficer",
|
profileId: item.current_holderId,
|
||||||
order: i + 2,
|
operator: "PersonnelOfficer",
|
||||||
workflowId: workflow.id,
|
order: i + 2,
|
||||||
...meta,
|
workflowId: workflow.id,
|
||||||
});
|
...meta,
|
||||||
await this.stateOperatorUserRepo.save(stateOperatorUser);
|
});
|
||||||
|
await this.stateOperatorUserRepo.save(stateOperatorUser);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue