feat(chalice): fixed cards api after DB changes

This commit is contained in:
Taha Yassine Kraiem 2023-01-10 17:39:53 +01:00
parent 197c7fc8d8
commit 9af58ee8a3
2 changed files with 2 additions and 2 deletions

View file

@ -379,7 +379,7 @@ def search_all(project_id, user_id, data: schemas.SearchCardsSchema, include_ser
query = cur.mogrify( query = cur.mogrify(
f"""SELECT metric_id, project_id, user_id, name, is_public, created_at, edited_at, f"""SELECT metric_id, project_id, user_id, name, is_public, created_at, edited_at,
metric_type, metric_of, metric_format, metric_value, view_type, is_pinned, metric_type, metric_of, metric_format, metric_value, view_type, is_pinned,
predefined_key, dashboards, owner_email, default_config AS config, thumbnail dashboards, owner_email, default_config AS config, thumbnail
FROM metrics FROM metrics
{sub_join} {sub_join}
LEFT JOIN LATERAL (SELECT COALESCE(jsonb_agg(connected_dashboards.* ORDER BY is_public,name),'[]'::jsonb) AS dashboards LEFT JOIN LATERAL (SELECT COALESCE(jsonb_agg(connected_dashboards.* ORDER BY is_public,name),'[]'::jsonb) AS dashboards

View file

@ -409,7 +409,7 @@ def search_all(project_id, user_id, data: schemas.SearchCardsSchema, include_ser
query = cur.mogrify( query = cur.mogrify(
f"""SELECT metric_id, project_id, user_id, name, is_public, created_at, edited_at, f"""SELECT metric_id, project_id, user_id, name, is_public, created_at, edited_at,
metric_type, metric_of, metric_format, metric_value, view_type, is_pinned, metric_type, metric_of, metric_format, metric_value, view_type, is_pinned,
predefined_key, dashboards, owner_email, default_config AS config, thumbnail dashboards, owner_email, default_config AS config, thumbnail
FROM metrics FROM metrics
{sub_join} {sub_join}
LEFT JOIN LATERAL (SELECT COALESCE(jsonb_agg(connected_dashboards.* ORDER BY is_public,name),'[]'::jsonb) AS dashboards LEFT JOIN LATERAL (SELECT COALESCE(jsonb_agg(connected_dashboards.* ORDER BY is_public,name),'[]'::jsonb) AS dashboards