From a1ddb2647bc4dd18b4dc000c345fe66be82d293c Mon Sep 17 00:00:00 2001 From: artaasadi Date: Thu, 26 Dec 2024 16:18:32 +0100 Subject: [PATCH] fix: change params type in TaskDefinition --- 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 1ae37dce9..53124cbe3 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.7.1 + github.com/opengovern/og-util v1.7.2 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 2882dc455..f7d2a1fac 100644 --- a/go.sum +++ b/go.sum @@ -1001,6 +1001,8 @@ github.com/opengovern/og-util v1.7.0 h1:2L3jXkasNLM+JO+vUmbmTCRf4ptjLvjDYqe/760C github.com/opengovern/og-util v1.7.0/go.mod h1:ob8RSaNZG3RWnLH3lDXQaVpIf+B8Ry7ds3twYlDJPp0= github.com/opengovern/og-util v1.7.1 h1:N2JgJWeMHGkfkGPgGd0Rr6w+Cjpbjc6+qfoidzjomFE= github.com/opengovern/og-util v1.7.1/go.mod h1:ob8RSaNZG3RWnLH3lDXQaVpIf+B8Ry7ds3twYlDJPp0= +github.com/opengovern/og-util v1.7.2 h1:eLGgqSHQmYuSehRBXJcn61pD7uslCzZe9wbwJaEKbc0= +github.com/opengovern/og-util v1.7.2/go.mod h1:ob8RSaNZG3RWnLH3lDXQaVpIf+B8Ry7ds3twYlDJPp0= 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 4876196d9..d825c6b4e 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]any `json:"params"` } diff --git a/services/tasks/scheduler/publisher.go b/services/tasks/scheduler/publisher.go index 4e344006e..a12437e3b 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]any, error) { if jsonb.Status != pgtype.Present { return nil, fmt.Errorf("JSONB data is not present") } - var result map[string][]string + var result map[string]any if err := json.Unmarshal(jsonb.Bytes, &result); err != nil { return nil, fmt.Errorf("failed to unmarshal JSONB: %w", err) }