Skip to content

Commit

Permalink
chore:store task executor user list
Browse files Browse the repository at this point in the history
  • Loading branch information
taolx0 committed Jul 27, 2023
1 parent 339cc8e commit 3af45c7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions sqle/model/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,9 @@ func (s *Storage) CreateWorkflowV2(subject, workflowId, desc string, user *User,
allExecutor[i] = executor

instanceRecords[i] = &WorkflowInstanceRecord{
TaskId: task.ID,
InstanceId: task.InstanceId,
TaskId: task.ID,
InstanceId: task.InstanceId,
ExecutorUserList: executor,
}
}

Expand Down Expand Up @@ -466,6 +467,13 @@ func (s *Storage) CreateWorkflowV2(subject, workflowId, desc string, user *User,
return errors.New(errors.ConnectStorageError, err)
}

for _, instanceRecord := range record.InstanceRecords {
if tx.Model(instanceRecord).Association("ExecutorUserList").Replace(instanceRecord.ExecutorUserList).Error != nil {
tx.Rollback()
return errors.New(errors.ConnectStorageError, err)
}
}

workflow.WorkflowRecordId = record.ID
err = tx.Save(workflow).Error
if err != nil {
Expand Down

0 comments on commit 3af45c7

Please sign in to comment.