From 686c0edb5cea7aa025a0ed0ba4188d759db63bac Mon Sep 17 00:00:00 2001 From: Livio Amstutz Date: Fri, 22 Oct 2021 16:45:30 +0200 Subject: [PATCH] fix: return flow type (#2563) --- internal/query/action_flow.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/query/action_flow.go b/internal/query/action_flow.go index cca43ab3f2..9961697b44 100644 --- a/internal/query/action_flow.go +++ b/internal/query/action_flow.go @@ -51,7 +51,7 @@ type Flow struct { } func (q *Queries) GetFlow(ctx context.Context, flowType domain.FlowType, orgID string) (*Flow, error) { - query, scan := q.prepareFlowQuery() + query, scan := q.prepareFlowQuery(flowType) stmt, args, err := query.Where( sq.Eq{ FlowsTriggersColumnFlowType.identifier(): flowType, @@ -172,7 +172,7 @@ func (q *Queries) prepareTriggerActionsQuery() (sq.SelectBuilder, func(*sql.Rows } } -func (q *Queries) prepareFlowQuery() (sq.SelectBuilder, func(*sql.Rows) (*Flow, error)) { +func (q *Queries) prepareFlowQuery(flowType domain.FlowType) (sq.SelectBuilder, func(*sql.Rows) (*Flow, error)) { return sq.Select( ActionColumnID.identifier(), ActionColumnCreationDate.identifier(), @@ -190,6 +190,7 @@ func (q *Queries) prepareFlowQuery() (sq.SelectBuilder, func(*sql.Rows) (*Flow, PlaceholderFormat(sq.Dollar), func(rows *sql.Rows) (*Flow, error) { flow := &Flow{ + Type: flowType, TriggerActions: make(map[domain.TriggerType][]*Action), } for rows.Next() {