Add terms of service acceptance date to user table (#1046)

* add tos_acceptance_date column to user

* send 451 UNAVAILABLE_FOR_LEGAL_REASONS status

* add create user REST endpoint

* adapt text-frontend to ToS requirements

* set DEBUG_IGNORE_TOS_ACCEPTANCE default to True (temporary change)

* update down revision to f60958968ff8
This commit is contained in:
Andreas Köpf
2023-02-01 23:53:21 +01:00
committed by GitHub
parent e0df9f0b7c
commit bbf038677c
12 changed files with 127 additions and 8 deletions
+10
View File
@@ -28,6 +28,16 @@ def _render_message(message: dict) -> str:
def main(backend_url: str = "http://127.0.0.1:8080", api_key: str = "1234"):
"""Simple REPL frontend."""
# make sure dummy user has accepted the terms of service
create_user_request = dict(USER)
create_user_request["tos_acceptance"] = True
response = requests.post(
f"{backend_url}/api/v1/frontend_users/", json=create_user_request, headers={"X-API-Key": api_key}
)
response.raise_for_status()
user = response.json()
typer.echo(f"user: {user}")
def _post(path: str, json: dict) -> dict:
response = requests.post(f"{backend_url}{path}", json=json, headers={"X-API-Key": api_key})
response.raise_for_status()
+10
View File
@@ -29,6 +29,16 @@ def _render_message(message: dict) -> str:
def main(backend_url: str = "http://127.0.0.1:8080", api_key: str = "1234"):
"""automates tasks"""
# make sure dummy user has accepted the terms of service
create_user_request = dict(USER)
create_user_request["tos_acceptance"] = True
response = requests.post(
f"{backend_url}/api/v1/frontend_users/", json=create_user_request, headers={"X-API-Key": api_key}
)
response.raise_for_status()
user = response.json()
typer.echo(f"user: {user}")
def _post(path: str, json: dict) -> dict:
response = requests.post(f"{backend_url}{path}", json=json, headers={"X-API-Key": api_key})
response.raise_for_status()