Api v1.15.0 (#1609)
* refactor(chalice): changed get account * refactor(chalice): refactored users code * fix(chalice): fixed path analysis empty exclude support
This commit is contained in:
parent
f249b7aa94
commit
8aad437f53
5 changed files with 9 additions and 4 deletions
|
|
@ -124,6 +124,8 @@ def path_analysis(project_id: int, data: schemas.CardPathAnalysis):
|
||||||
|
|
||||||
exclusions = {}
|
exclusions = {}
|
||||||
for i, ef in enumerate(data.excludes):
|
for i, ef in enumerate(data.excludes):
|
||||||
|
if len(ef.value) == 0:
|
||||||
|
continue
|
||||||
if ef.type in data.metric_value:
|
if ef.type in data.metric_value:
|
||||||
f_k = f"exclude_{i}"
|
f_k = f"exclude_{i}"
|
||||||
extra_values = {**extra_values, **sh.multi_values(ef.value, value_key=f_k)}
|
extra_values = {**extra_values, **sh.multi_values(ef.value, value_key=f_k)}
|
||||||
|
|
|
||||||
|
|
@ -100,8 +100,8 @@ def get_account(context: schemas.CurrentContext = Depends(OR_context)):
|
||||||
r = users.get(tenant_id=context.tenant_id, user_id=context.user_id)
|
r = users.get(tenant_id=context.tenant_id, user_id=context.user_id)
|
||||||
t = tenants.get_by_tenant_id(context.tenant_id)
|
t = tenants.get_by_tenant_id(context.tenant_id)
|
||||||
if t is not None:
|
if t is not None:
|
||||||
t.pop("createdAt")
|
t["createdAt"] = TimeUTC.datetime_to_timestamp(t["createdAt"])
|
||||||
t["tenantName"] = t.pop("name")
|
t["tenantName"] = t.get("name")
|
||||||
return {
|
return {
|
||||||
'data': {
|
'data': {
|
||||||
**r,
|
**r,
|
||||||
|
|
|
||||||
|
|
@ -129,6 +129,8 @@ def path_analysis(project_id: int, data: schemas.CardPathAnalysis):
|
||||||
|
|
||||||
exclusions = {}
|
exclusions = {}
|
||||||
for i, ef in enumerate(data.excludes):
|
for i, ef in enumerate(data.excludes):
|
||||||
|
if len(ef.value) == 0:
|
||||||
|
continue
|
||||||
if ef.type in data.metric_value:
|
if ef.type in data.metric_value:
|
||||||
f_k = f"exclude_{i}"
|
f_k = f"exclude_{i}"
|
||||||
extra_values = {**extra_values, **sh.multi_values(ef.value, value_key=f_k)}
|
extra_values = {**extra_values, **sh.multi_values(ef.value, value_key=f_k)}
|
||||||
|
|
|
||||||
|
|
@ -249,6 +249,7 @@ def get(user_id, tenant_id):
|
||||||
cur.mogrify(
|
cur.mogrify(
|
||||||
f"""SELECT
|
f"""SELECT
|
||||||
users.user_id,
|
users.user_id,
|
||||||
|
users.tenant_id,
|
||||||
email,
|
email,
|
||||||
role,
|
role,
|
||||||
users.name,
|
users.name,
|
||||||
|
|
|
||||||
|
|
@ -105,8 +105,8 @@ def get_account(context: schemas.CurrentContext = Depends(OR_context)):
|
||||||
r = users.get(tenant_id=context.tenant_id, user_id=context.user_id)
|
r = users.get(tenant_id=context.tenant_id, user_id=context.user_id)
|
||||||
t = tenants.get_by_tenant_id(context.tenant_id)
|
t = tenants.get_by_tenant_id(context.tenant_id)
|
||||||
if t is not None:
|
if t is not None:
|
||||||
t.pop("createdAt")
|
t["createdAt"] = TimeUTC.datetime_to_timestamp(t["createdAt"])
|
||||||
t["tenantName"] = t.pop("name")
|
t["tenantName"] = t.get("name")
|
||||||
return {
|
return {
|
||||||
'data': {
|
'data': {
|
||||||
**r,
|
**r,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue