diff --git a/api/chalicelib/core/custom_metrics.py b/api/chalicelib/core/custom_metrics.py index 66e1e0779..7b68ea124 100644 --- a/api/chalicelib/core/custom_metrics.py +++ b/api/chalicelib/core/custom_metrics.py @@ -524,7 +524,8 @@ def search_all(project_id, user_id, data: schemas.SearchCardsSchema, include_ser def get_all(project_id, user_id): default_search = schemas.SearchCardsSchema() - result = rows = search_all(project_id=project_id, user_id=user_id, data=default_search) + result = [] + rows = search_all(project_id=project_id, user_id=user_id, data=default_search) while len(rows) == default_search.limit: default_search.page += 1 rows = search_all(project_id=project_id, user_id=user_id, data=default_search) diff --git a/api/chalicelib/core/dashboards.py b/api/chalicelib/core/dashboards.py index ed4ebcb6c..36b58dfa0 100644 --- a/api/chalicelib/core/dashboards.py +++ b/api/chalicelib/core/dashboards.py @@ -34,8 +34,13 @@ def create_dashboard(project_id, user_id, data: schemas.CreateDashboardSchema): def get_dashboards(project_id, user_id): with pg_client.PostgresClient() as cur: - pg_query = f"""SELECT * + pg_query = f"""SELECT *, owner_email FROM dashboards + LEFT JOIN LATERAL (SELECT email AS owner_email + FROM users + WHERE deleted_at ISNULL + AND users.user_id = dashboards.user_id + ) AS owner ON (TRUE) WHERE deleted_at ISNULL AND project_id = %(projectId)s AND (user_id = %(userId)s OR is_public);""" diff --git a/ee/api/chalicelib/core/custom_metrics.py b/ee/api/chalicelib/core/custom_metrics.py index 7b5f2be1a..b34bfa7d1 100644 --- a/ee/api/chalicelib/core/custom_metrics.py +++ b/ee/api/chalicelib/core/custom_metrics.py @@ -556,7 +556,8 @@ def search_all(project_id, user_id, data: schemas.SearchCardsSchema, include_ser def get_all(project_id, user_id): default_search = schemas.SearchCardsSchema() - result = rows = search_all(project_id=project_id, user_id=user_id, data=default_search) + result = [] + rows = search_all(project_id=project_id, user_id=user_id, data=default_search) while len(rows) == default_search.limit: default_search.page += 1 rows = search_all(project_id=project_id, user_id=user_id, data=default_search)