From 6799587cd0ce852cf3ff1ac8c7d4fecce801b4ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E6=99=93=E7=94=9F?= Date: Sun, 26 Nov 2023 10:31:25 +0800 Subject: [PATCH 1/2] feat: store workflowVersionID into submission table --- .../submission/domain/submission/event_create_handler.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 } From d9480d81f3b7181a39b62bace5cb228f6d8b24e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E6=99=93=E7=94=9F?= Date: Sun, 26 Nov 2023 11:16:28 +0800 Subject: [PATCH 2/2] add workflowVersionID in RunConfig --- internal/context/submission/domain/submission/event.go | 1 + 1 file changed, 1 insertion(+) 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 {