From 9dc7809a124743751706325f2c31ff69f0184b98 Mon Sep 17 00:00:00 2001 From: Arvindh Date: Fri, 10 Jan 2025 17:33:46 +0530 Subject: [PATCH] add: listing of channels Signed-off-by: Arvindh --- clients/postgres/clients.go | 4 ++++ clients/postgres/clients_test.go | 2 +- pkg/sdk/setup_test.go | 1 - 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/clients/postgres/clients.go b/clients/postgres/clients.go index 1e5008198e..92435ed719 100644 --- a/clients/postgres/clients.go +++ b/clients/postgres/clients.go @@ -901,6 +901,10 @@ func PageQuery(pm clients.Page) (string, error) { query = append(query, mq) } + if len(pm.IDs) != 0 { + query = append(query, fmt.Sprintf("c.id IN ('%s')", strings.Join(pm.IDs, "','"))) + } + if pm.Status != clients.AllStatus { query = append(query, "c.status = :status") } diff --git a/clients/postgres/clients_test.go b/clients/postgres/clients_test.go index cbbab3c3bb..8a6e46d0d5 100644 --- a/clients/postgres/clients_test.go +++ b/clients/postgres/clients_test.go @@ -1626,7 +1626,7 @@ func TestSearchClients(t *testing.T) { } } -func TestRetrievByIDs(t *testing.T) { +func TestRetrieveByIDs(t *testing.T) { t.Cleanup(func() { _, err := db.Exec("DELETE FROM clients") require.Nil(t, err, fmt.Sprintf("clean clients unexpected error: %s", err)) diff --git a/pkg/sdk/setup_test.go b/pkg/sdk/setup_test.go index c55789dfe4..4d3ba83a4c 100644 --- a/pkg/sdk/setup_test.go +++ b/pkg/sdk/setup_test.go @@ -216,7 +216,6 @@ func convertChannel(g sdk.Channel) mgchannels.Channel { UpdatedAt: g.UpdatedAt, UpdatedBy: g.UpdatedBy, Status: status, - Permissions: g.Permissions, } }