diff --git a/internal/context/submission/domain/submission/event.go b/internal/context/submission/domain/submission/event.go index 0a7d9bf..3351f77 100644 --- a/internal/context/submission/domain/submission/event.go +++ b/internal/context/submission/domain/submission/event.go @@ -161,6 +161,7 @@ type RunConfig struct { MainWorkflowFilePath string WorkflowEngineParameters map[string]interface{} Version string + WorkflowVersionID string } func NewEventCreateRuns(workspaceID, submissionID, submissionType string, inputs, outputs map[string]interface{}, dataModelID *string, DataModelRowIDs []string, runConfig *RunConfig) *EventCreateRuns { diff --git a/internal/context/submission/domain/submission/event_create_handler.go b/internal/context/submission/domain/submission/event_create_handler.go index 3e8c589..bb44548 100644 --- a/internal/context/submission/domain/submission/event_create_handler.go +++ b/internal/context/submission/domain/submission/event_create_handler.go @@ -35,12 +35,16 @@ func (h *CreateHandler) Handle(ctx context.Context, event *CreateEvent) (err err if err != nil { return err } - // todo we should store the data model & workflow used in submission createRunEvent, err := h.genCreateRunEvent(ctx, event, sub) if err != nil { return err } - + // write workflowVersionID into submission table + sub.WorkflowVersionID = createRunEvent.RunConfig.WorkflowVersionID + err = h.repository.Save(ctx, sub) + if err != nil { + return err + } return h.eventbus.Publish(ctx, createRunEvent) } @@ -71,6 +75,7 @@ func (h *CreateHandler) genCreateRunEvent(ctx context.Context, event *CreateEven WorkflowContents: files, WorkflowEngineParameters: workflowEngineParameters, Version: getWorkflowVersionResp.Version.LanguageVersion, + WorkflowVersionID: getWorkflowVersionResp.Version.Id, }), nil }