Update routes/hello.py
Browse files- routes/hello.py +20 -0
routes/hello.py
CHANGED
@@ -232,6 +232,26 @@ def check_onboarding(account_id: str):
|
|
232 |
class AccountLinkRequest(BaseModel):
|
233 |
account_id: str
|
234 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
@router.post("/account_link")
|
236 |
def create_account_link(link_data: AccountLinkRequest):
|
237 |
try:
|
|
|
232 |
class AccountLinkRequest(BaseModel):
|
233 |
account_id: str
|
234 |
|
235 |
+
@router.get("/terms")
|
236 |
+
def get_terms(type: str = Query(..., regex="^(use|privacy)$")):
|
237 |
+
try:
|
238 |
+
term_type = "Terms of Use" if type == "use" else "Privacy Policy"
|
239 |
+
|
240 |
+
url = f"{SUPABASE_URL}/rest/v1/Configuration?type=eq.{term_type}&select=text"
|
241 |
+
response = requests.get(url, headers=SUPABASE_HEADERS)
|
242 |
+
|
243 |
+
if response.status_code != 200:
|
244 |
+
raise HTTPException(status_code=500, detail="Erro ao acessar a tabela Configuration")
|
245 |
+
|
246 |
+
data = response.json()
|
247 |
+
if not data:
|
248 |
+
raise HTTPException(status_code=404, detail="Termo não encontrado")
|
249 |
+
|
250 |
+
return {"type": term_type, "text": data[0]["text"]}
|
251 |
+
|
252 |
+
except Exception as e:
|
253 |
+
raise HTTPException(status_code=500, detail=str(e))
|
254 |
+
|
255 |
@router.post("/account_link")
|
256 |
def create_account_link(link_data: AccountLinkRequest):
|
257 |
try:
|