feat(chalice): return projectId with GDPR data
This commit is contained in:
parent
1ba5331eee
commit
38449ccd8e
3 changed files with 23 additions and 6 deletions
|
|
@ -219,7 +219,9 @@ def get_gdpr(project_id):
|
|||
AND s.deleted_at IS NULL;""",
|
||||
{"project_id": project_id})
|
||||
)
|
||||
return cur.fetchone()["gdpr"]
|
||||
row = cur.fetchone()["gdpr"]
|
||||
row["projectId"] = project_id
|
||||
return row
|
||||
|
||||
|
||||
def edit_gdpr(project_id, gdpr):
|
||||
|
|
@ -235,7 +237,12 @@ def edit_gdpr(project_id, gdpr):
|
|||
RETURNING gdpr;""",
|
||||
{"project_id": project_id, "gdpr": json.dumps(gdpr)})
|
||||
)
|
||||
return cur.fetchone()["gdpr"]
|
||||
row = cur.fetchone()
|
||||
if not row:
|
||||
return {"errors": ["something went wrong"]}
|
||||
row = row["gdpr"]
|
||||
row["projectId"] = project_id
|
||||
return row
|
||||
|
||||
|
||||
def get_internal_project_id(project_key):
|
||||
|
|
|
|||
|
|
@ -497,7 +497,10 @@ def get_gdpr(projectId: int, context: schemas.CurrentContext = Depends(OR_contex
|
|||
@app.post('/{projectId}/gdpr', tags=["projects", "gdpr"])
|
||||
def edit_gdpr(projectId: int, data: schemas.GdprSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": projects.edit_gdpr(project_id=projectId, gdpr=data.dict())}
|
||||
result = projects.edit_gdpr(project_id=projectId, gdpr=data.dict())
|
||||
if "errors" in result:
|
||||
return result
|
||||
return {"data": result}
|
||||
|
||||
|
||||
@public_app.post('/password/reset-link', tags=["reset password"])
|
||||
|
|
|
|||
|
|
@ -210,11 +210,13 @@ def get_gdpr(project_id):
|
|||
SELECT
|
||||
gdpr
|
||||
FROM public.projects AS s
|
||||
where s.project_id =%(project_id)s
|
||||
WHERE s.project_id =%(project_id)s
|
||||
AND s.deleted_at IS NULL;""",
|
||||
{"project_id": project_id})
|
||||
)
|
||||
return cur.fetchone()["gdpr"]
|
||||
row = cur.fetchone()["gdpr"]
|
||||
row["projectId"] = project_id
|
||||
return row
|
||||
|
||||
|
||||
def edit_gdpr(project_id, gdpr):
|
||||
|
|
@ -230,7 +232,12 @@ def edit_gdpr(project_id, gdpr):
|
|||
RETURNING gdpr;""",
|
||||
{"project_id": project_id, "gdpr": json.dumps(gdpr)})
|
||||
)
|
||||
return cur.fetchone()["gdpr"]
|
||||
row = cur.fetchone()
|
||||
if not row:
|
||||
return {"errors": ["something went wrong"]}
|
||||
row = row["gdpr"]
|
||||
row["projectId"] = project_id
|
||||
return row
|
||||
|
||||
|
||||
def get_internal_project_id(project_key):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue