From 79b05042e0743599e2952245334572f79f5bb599 Mon Sep 17 00:00:00 2001 From: artaasadi Date: Fri, 20 Dec 2024 01:42:27 +0100 Subject: [PATCH] fix: get multiple parameters in task --- go.mod | 2 +- go.sum | 2 ++ services/tasks/api/tasks.go | 4 ++-- services/tasks/scheduler/publisher.go | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index dbd5f7511..3d8598b75 100644 --- a/go.mod +++ b/go.mod @@ -43,7 +43,7 @@ require ( github.com/lib/pq v1.10.9 github.com/nats-io/nats.go v1.36.0 github.com/open-policy-agent/opa v0.69.0 - github.com/opengovern/og-util v1.1.14-0.20241219130558-d70ee92c91fa + github.com/opengovern/og-util v1.2.1 github.com/opensearch-project/opensearch-go/v2 v2.3.0 github.com/opensearch-project/opensearch-go/v4 v4.2.0 github.com/ory/dockertest/v3 v3.10.0 diff --git a/go.sum b/go.sum index 2a47cd7d9..d9d94cb49 100644 --- a/go.sum +++ b/go.sum @@ -999,6 +999,8 @@ github.com/opencontainers/runc v1.2.0 h1:qke7ZVCmJcKrJVY2iHJVC+0kql9uYdkusOPsQOO github.com/opencontainers/runc v1.2.0/go.mod h1:/PXzF0h531HTMsYQnmxXkBD7YaGShm/2zcRB79dksUc= github.com/opengovern/og-util v1.1.14-0.20241219130558-d70ee92c91fa h1:srcr2aeDLSN+t2BhuB9JvWTUDhvBx1DVqXhEXasSSV4= github.com/opengovern/og-util v1.1.14-0.20241219130558-d70ee92c91fa/go.mod h1:Q7Pd/1SzDtYoF3iAd4/FSBmFihis+7OIeDpU94xawXQ= +github.com/opengovern/og-util v1.2.1 h1:jTYMnJ4au3b9YsLbkmsYvFORrCeUlG79KGH66b8XWWI= +github.com/opengovern/og-util v1.2.1/go.mod h1:Q7Pd/1SzDtYoF3iAd4/FSBmFihis+7OIeDpU94xawXQ= github.com/opensearch-project/opensearch-go/v2 v2.3.0 h1:nQIEMr+A92CkhHrZgUhcfsrZjibvB3APXf2a1VwCmMQ= github.com/opensearch-project/opensearch-go/v2 v2.3.0/go.mod h1:8LDr9FCgUTVoT+5ESjc2+iaZuldqE+23Iq0r1XeNue8= github.com/opensearch-project/opensearch-go/v4 v4.2.0 h1:uaBexfVdeSU15yOUPYF+IY059koVP0oNQPyoSde6N/A= diff --git a/services/tasks/api/tasks.go b/services/tasks/api/tasks.go index 234d5f3c5..4876196d9 100644 --- a/services/tasks/api/tasks.go +++ b/services/tasks/api/tasks.go @@ -21,6 +21,6 @@ type TaskResponse struct { } type RunTaskRequest struct { - TaskID string `json:"task_id"` - Params map[string]string `json:"params"` + TaskID string `json:"task_id"` + Params map[string][]string `json:"params"` } diff --git a/services/tasks/scheduler/publisher.go b/services/tasks/scheduler/publisher.go index d3911aa21..4e344006e 100644 --- a/services/tasks/scheduler/publisher.go +++ b/services/tasks/scheduler/publisher.go @@ -85,12 +85,12 @@ func (s *TaskScheduler) runPublisher(ctx context.Context) error { return nil } -func JSONBToMap(jsonb pgtype.JSONB) (map[string]string, error) { +func JSONBToMap(jsonb pgtype.JSONB) (map[string][]string, error) { if jsonb.Status != pgtype.Present { return nil, fmt.Errorf("JSONB data is not present") } - var result map[string]string + var result map[string][]string if err := json.Unmarshal(jsonb.Bytes, &result); err != nil { return nil, fmt.Errorf("failed to unmarshal JSONB: %w", err) }