This commit is contained in:
dongli 2025-06-07 13:17:37 -07:00
parent 7955b5884a
commit 6254d13098
6 changed files with 2 additions and 84 deletions

View File

@ -1,6 +0,0 @@
from app.common.daos.code_depot.code_depot_dao import CodeDepotDao
code_depot_dao = CodeDepotDao()
def get_code_depot_dao() -> CodeDepotDao:
return code_depot_dao

View File

@ -1,19 +0,0 @@
from app.common.models.code_depot.code_depot import CodeDepotDoc
class CodeDepotDao():
def __init__(self):
pass
async def get_code_depot_by_product_id(self, product_id: str) -> CodeDepotDoc:
"""
Retrieve code depot by product id
"""
return await CodeDepotDoc.find_one({"product_id": product_id})
async def insert_code_depot(self, code_depot: CodeDepotDoc) -> CodeDepotDoc:
"""
Insert a new code depot into the database
"""
return await CodeDepotDoc.insert_one(code_depot)

View File

@ -1,6 +0,0 @@
from app.common.daos.deployment.deployment_dao import DeploymentDao
deployment_dao = DeploymentDao()
def get_deployment_dao() -> DeploymentDao:
return deployment_dao

View File

@ -1,46 +0,0 @@
from app.common.models.deployment.deployment import Deployment
class DeploymentDao():
def __init__(self):
pass
async def create_deployment(self, deployment_data: Deployment) -> Deployment:
# Logic to create a new deployment
return await Deployment.insert(deployment_data)
async def get_deployments_by_deployment_id(self, deployment_id: str):
# Logic to get a deployment by ID
pass
async def get_deployments_by_project_id(self, project_id: str):
# Logic to get deployments by project ID
pass
async def get_deployments_by_product_id(self, project_id: str):
# Logic to get deployments by project ID
pass
async def get_latest_deployment_by_project_id(self, project_id: str):
# Logic to get the latest deployment by project ID
pass
async def get_deployments_by_user_id(self, user_id: str):
# Logic to get deployments by user ID
pass
async def update_deployment(self, deployment_id: str, deployment_data: dict):
# Logic to update a deployment
pass
async def delete_deployment(self, deployment_id: str):
# Logic to delete a deployment
pass

View File

@ -7,8 +7,6 @@ import httpx
from fastapi import HTTPException, Depends
from app.common.config.site_settings import site_settings
from app.common.daos.code_depot import get_code_depot_dao, CodeDepotDao
from app.common.daos.deployment import DeploymentDao, get_deployment_dao
from app.common.models import Deployment
from app.common.models.code_depot.code_depot import CodeDepotDoc, DepotStatus
from app.common.models.deployment.deployment import InitDeploymentRequest
@ -22,7 +20,6 @@ class DeploymentService:
async def init_deployment(
self,
request: InitDeploymentRequest,
dao: DeploymentDao = get_deployment_dao()
) -> Deployment:
"""
"""
@ -120,12 +117,11 @@ class DeploymentService:
async def _get_code_depot_by_product_id(
self,
product_id: str,
code_depot_dao: CodeDepotDao = get_code_depot_dao()
) -> CodeDepotDoc:
"""
Retrieve code depot by product id
"""
code_depot = await code_depot_dao.get_code_depot_by_product_id(product_id)
code_depot = await CodeDepotDoc.find_one(CodeDepotDoc.product_id == product_id)
if not code_depot:
raise HTTPException(status_code=404,
detail="Code depot not found for the given product id, "
@ -164,7 +160,6 @@ class DeploymentService:
# TODO: dummy test code, remove later
async def create_dummy_code_depot(
self,
code_depot_dao: CodeDepotDao = Depends(get_code_depot_dao)
) -> CodeDepotDoc:
"""
Create a dummy code depot for testing purposes.
@ -176,7 +171,7 @@ class DeploymentService:
depot_status=DepotStatus.CREATED
)
return await code_depot.insert_one(code_depot)
return await CodeDepotDoc.insert_one(code_depot)
deployment_service = DeploymentService()