Обновить routers/client.py
This commit is contained in:
parent
32d070d8ce
commit
675eca167b
|
@ -14,6 +14,8 @@ from typing import Union
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
|
from types import SimpleNamespace
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,16 +39,19 @@ def get_filtered_values(category, data):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
# Пример данных
|
# Пример данных
|
||||||
clients = {
|
|
||||||
1: {"username": "John Doe", "email": "john@example.com", "phone": "+123456781"},
|
|
||||||
44: {"username": "Jane Smith", "email": "jane@example.com", "phone": "+987654321"}
|
|
||||||
}
|
|
||||||
@router.get("/get_client/{client_id}", include_in_schema=False)
|
@router.get("/get_client/{client_id}", include_in_schema=False)
|
||||||
async def get_client_modal(client_id: int, db: Session = Depends(get_async_session)):
|
async def get_client_modal(client_id: int, db: Session = Depends(get_async_session)):
|
||||||
# client = clients.get(client_id) # Используй clients вместо clients_db
|
data = SimpleNamespace(user_id=client_id)
|
||||||
# print(f"==============================={type(client)}")
|
print(data)
|
||||||
|
await get_update(db, data)
|
||||||
|
|
||||||
client = await client_list(client_id, db)
|
client = await client_list(client_id, db)
|
||||||
|
|
||||||
|
# print(client)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if not client:
|
if not client:
|
||||||
raise HTTPException(status_code=404, detail="Client not found")
|
raise HTTPException(status_code=404, detail="Client not found")
|
||||||
return JSONResponse(content=client)
|
return JSONResponse(content=client)
|
||||||
|
@ -98,13 +103,13 @@ async def process_client_data(
|
||||||
|
|
||||||
jobs = await get_filtered_jobs(
|
jobs = await get_filtered_jobs(
|
||||||
db,
|
db,
|
||||||
user_job_titles=["Electronics Engineer", "Hardware Engineer"],
|
user_job_titles=["3D Modeler,3D Printing Technician,3D Visualizer"],
|
||||||
minimum_annual_salary=None,
|
minimum_annual_salary=None,
|
||||||
salary_currency=None,
|
salary_currency=None,
|
||||||
user_location_type=None,
|
user_location_type=None,
|
||||||
user_locations=["Burnaby, Canada", "Vancouver, Canada", "Toronto, Canada"],
|
user_locations=["Burnaby, Canada", "Vancouver, Canada", "Toronto, Canada"],
|
||||||
user_levels=["Mid", "Senior", "Manager"],
|
user_levels=["Mid", "Senior", "Manager"],
|
||||||
user_job_types=["Full-time", "Permanent"]
|
user_job_types=["Part-Time", "Permanent"]
|
||||||
)
|
)
|
||||||
|
|
||||||
for job in jobs:
|
for job in jobs:
|
||||||
|
@ -145,16 +150,16 @@ async def client(
|
||||||
phone_num = data.json_data['phone_num']
|
phone_num = data.json_data['phone_num']
|
||||||
|
|
||||||
# Добавляем фоновые задачи
|
# Добавляем фоновые задачи
|
||||||
background_tasks.add_task(
|
# background_tasks.add_task(
|
||||||
process_client_data,
|
# process_client_data,
|
||||||
db=db,
|
# db=db,
|
||||||
data=data,
|
# data=data,
|
||||||
user_id=user_id,
|
# user_id=user_id,
|
||||||
first_name=first_name,
|
# first_name=first_name,
|
||||||
last_name=last_name,
|
# last_name=last_name,
|
||||||
email_addr=email_addr,
|
# email_addr=email_addr,
|
||||||
phone_num=phone_num
|
# phone_num=phone_num
|
||||||
)
|
# )
|
||||||
|
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
raise HTTPException(status_code=400, detail=f"Missing required field: {e}")
|
raise HTTPException(status_code=400, detail=f"Missing required field: {e}")
|
||||||
|
|
Loading…
Reference in New Issue