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