Dev (#2753)
* fix(chalice): fixed Math-operators validation refactor(chalice): search for sessions that have events for heatmaps * refactor(chalice): search for sessions that have at least 1 location event for heatmaps * fix(chalice): fixed Math-operators validation refactor(chalice): search for sessions that have events for heatmaps * refactor(chalice): search for sessions that have at least 1 location event for heatmaps * feat(chalice): autocomplete return top 10 with stats * fix(chalice): fixed autocomplete top 10 meta-filters * fix(chalice): create role return list of projects
This commit is contained in:
parent
5b46f673c3
commit
dd5368219f
1 changed files with 4 additions and 1 deletions
|
|
@ -101,12 +101,15 @@ def create(tenant_id, user_id, data: schemas.RolePayloadSchema):
|
|||
cur.execute(query=query)
|
||||
row = cur.fetchone()
|
||||
row["created_at"] = TimeUTC.datetime_to_timestamp(row["created_at"])
|
||||
row["projects"] = []
|
||||
if not data.all_projects:
|
||||
role_id = row["role_id"]
|
||||
query = cur.mogrify(f"""INSERT INTO roles_projects(role_id, project_id)
|
||||
VALUES {",".join(f"(%(role_id)s,%(project_id_{i})s)" for i in range(len(data.projects)))};""",
|
||||
VALUES {",".join(f"(%(role_id)s,%(project_id_{i})s)" for i in range(len(data.projects)))}
|
||||
RETURNING project_id;""",
|
||||
{"role_id": role_id, **{f"project_id_{i}": p for i, p in enumerate(data.projects)}})
|
||||
cur.execute(query=query)
|
||||
row["projects"] = [r["project_id"] for r in cur.fetchall()]
|
||||
return helper.dict_to_camel_case(row)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue