Depends only works with fastApi methods, so don't use Depends for other methods

This commit is contained in:
dongli 2025-06-07 12:34:34 -07:00
parent ab7e6728b5
commit b83f5fd606

View File

@ -22,7 +22,7 @@ class DeploymentService:
async def init_deployment(
self,
request: InitDeploymentRequest,
dao: DeploymentDao = Depends(get_deployment_dao)
dao: DeploymentDao = get_deployment_dao()
) -> Deployment:
"""
"""
@ -117,7 +117,7 @@ class DeploymentService:
async def _get_code_depot_by_product_id(
self,
product_id: str,
code_depot_dao: CodeDepotDao = Depends(get_code_depot_dao)
code_depot_dao: CodeDepotDao = get_code_depot_dao()
) -> CodeDepotDoc:
"""
Retrieve code depot by product id
@ -147,16 +147,18 @@ class DeploymentService:
) -> bool:
"""
Start the deployment
Return true atm, modify calling reconsile service later
"""
async with httpx.AsyncClient() as client:
response = await client.post(
f"{reconsile_base_url}/api/devops/reconcile",
json=deployment.model_dump()
)
if response.status_code != 200:
raise HTTPException(status_code=response.status_code, detail=response.text)
# async with httpx.AsyncClient() as client:
# response = await client.post(
# f"{reconsile_base_url}/api/devops/reconcile",
# json=deployment.model_dump()
# )
# if response.status_code != 200:
# raise HTTPException(status_code=response.status_code, detail=response.text)
return True
# TODO: dummy test code, remove later
async def create_dummy_code_depot(
self,
code_depot_dao: CodeDepotDao = Depends(get_code_depot_dao)