diff --git a/pkg/server/get.go b/pkg/server/get.go index a257193..c71c781 100644 --- a/pkg/server/get.go +++ b/pkg/server/get.go @@ -42,8 +42,8 @@ func (h *serverHandler) getManyConfigsHandle(w http.ResponseWriter, r *http.Requ var ErrInvalidParams = errors.New("invalid params: only 'id' and 'endpoint' with a valid URL are accepted") -func buildQueryFilter(values url.Values) (map[string]string, error) { - filter := map[string]string{} +func buildQueryFilter(values url.Values) (map[string]any, error) { + filter := map[string]any{} for key, value := range values { if len(value) != 1 { diff --git a/pkg/server/test.go b/pkg/server/test.go index 73e054d..04fc097 100644 --- a/pkg/server/test.go +++ b/pkg/server/test.go @@ -14,7 +14,7 @@ import ( func (h *serverHandler) testOneConfigHandle(w http.ResponseWriter, r *http.Request) { id := chi.URLParam(r, PathParamId) - cfgs, err := h.store.FindManyConfigs(r.Context(), map[string]string{"id": id}) + cfgs, err := h.store.FindManyConfigs(r.Context(), map[string]any{"id": id}) if err == nil { if len(cfgs) == 0 { sharedlogging.GetLogger(r.Context()).Errorf("GET %s/%s%s: %s", PathConfigs, id, PathTest, storage.ErrConfigNotFound) diff --git a/pkg/storage/postgres/postgres.go b/pkg/storage/postgres/postgres.go index 637c8d6..990c2ae 100644 --- a/pkg/storage/postgres/postgres.go +++ b/pkg/storage/postgres/postgres.go @@ -48,7 +48,7 @@ func NewStore() (storage.Store, error) { return Store{db: db}, nil } -func (s Store) FindManyConfigs(ctx context.Context, filters map[string]string) ([]webhooks.Config, error) { +func (s Store) FindManyConfigs(ctx context.Context, filters map[string]any) ([]webhooks.Config, error) { res := []webhooks.Config{} sq := s.db.NewSelect().Model(&res) for key, val := range filters { diff --git a/pkg/storage/postgres/postgres_test.go b/pkg/storage/postgres/postgres_test.go index f4f504e..ddc0aaf 100644 --- a/pkg/storage/postgres/postgres_test.go +++ b/pkg/storage/postgres/postgres_test.go @@ -40,7 +40,7 @@ func TestStore(t *testing.T) { store, err := postgres.NewStore() require.NoError(t, err) - cfgs, err := store.FindManyConfigs(context.Background(), map[string]string{}) + cfgs, err := store.FindManyConfigs(context.Background(), map[string]any{}) require.NoError(t, err) require.Equal(t, 0, len(cfgs)) diff --git a/pkg/storage/store.go b/pkg/storage/store.go index 26bffb9..649c490 100644 --- a/pkg/storage/store.go +++ b/pkg/storage/store.go @@ -15,7 +15,7 @@ var ( ) type Store interface { - FindManyConfigs(ctx context.Context, filter map[string]string) ([]webhooks.Config, error) + FindManyConfigs(ctx context.Context, filter map[string]any) ([]webhooks.Config, error) InsertOneConfig(ctx context.Context, cfg webhooks.ConfigUser) (webhooks.Config, error) DeleteOneConfig(ctx context.Context, id string) error UpdateOneConfigActivation(ctx context.Context, id string, active bool) (webhooks.Config, error) diff --git a/pkg/worker/worker.go b/pkg/worker/worker.go index 9150524..16aedfd 100644 --- a/pkg/worker/worker.go +++ b/pkg/worker/worker.go @@ -151,9 +151,9 @@ func (w *Worker) processMessage(ctx context.Context, msgValue []byte) error { ev.Type = strings.Join([]string{eventApp, eventType}, ".") } - filter := map[string]string{ + filter := map[string]any{ "event_types": ev.Type, - "active": "true", + "active": true, } sharedlogging.GetLogger(ctx).Debugf("searching configs with filter: %+v", filter) cfgs, err := w.store.FindManyConfigs(ctx, filter)