feat(chalice): changed update dashboard response

This commit is contained in:
Taha Yassine Kraiem 2023-02-24 15:31:57 +01:00
parent 15ad4313fc
commit 54fa17dc3f

View file

@ -121,7 +121,7 @@ def update_dashboard(project_id, user_id, dashboard_id, data: schemas.EditDashbo
WHERE dashboards.project_id = %(projectId)s
AND dashboard_id = %(dashboard_id)s
AND (dashboards.user_id = %(userId)s OR is_public)
RETURNING dashboard_id,name,description,is_public,createdAt;"""
RETURNING dashboard_id,name,description,is_public,created_at;"""
if data.metrics is not None and len(data.metrics) > 0:
pg_query = f"""WITH dash AS ({pg_query})
INSERT INTO dashboard_widgets(dashboard_id, metric_id, user_id, config)
@ -137,7 +137,8 @@ def update_dashboard(project_id, user_id, dashboard_id, data: schemas.EditDashbo
cur.execute(cur.mogrify(pg_query, params))
row = cur.fetchone()
if row:
row["created_at"] = TimeUTC.datetime_to_timestamp(row["created_at"])
return helper.dict_to_camel_case(row)