REFACTOR API gateway fix 9

This commit is contained in:
Urtzi Alfaro
2025-07-26 23:34:46 +02:00
parent 97ae58fb06
commit abad270282

View File

@@ -45,7 +45,7 @@ def get_training_service() -> TrainingService:
"""Factory function for TrainingService dependency""" """Factory function for TrainingService dependency"""
return TrainingService() return TrainingService()
@router.post("/tenants/{tenant_id}/jobs", response_model=TrainingJobResponse) @router.post("/tenants/{tenant_id}/training/jobs", response_model=TrainingJobResponse)
async def start_training_job( async def start_training_job(
request: TrainingJobRequest, request: TrainingJobRequest,
background_tasks: BackgroundTasks, background_tasks: BackgroundTasks,
@@ -110,7 +110,7 @@ async def start_training_job(
tenant_id=tenant_id) tenant_id=tenant_id)
raise HTTPException(status_code=500, detail=f"Failed to start training job: {str(e)}") raise HTTPException(status_code=500, detail=f"Failed to start training job: {str(e)}")
@router.get("/tenants/{tenant_id}/jobs", response_model=List[TrainingJobResponse]) @router.get("/tenants/{tenant_id}/training/jobs", response_model=List[TrainingJobResponse])
async def get_training_jobs( async def get_training_jobs(
status: Optional[TrainingStatus] = Query(None, description="Filter jobs by status"), status: Optional[TrainingStatus] = Query(None, description="Filter jobs by status"),
limit: int = Query(100, ge=1, le=1000), limit: int = Query(100, ge=1, le=1000),
@@ -146,7 +146,7 @@ async def get_training_jobs(
tenant_id=tenant_id) tenant_id=tenant_id)
raise HTTPException(status_code=500, detail=f"Failed to get training jobs: {str(e)}") raise HTTPException(status_code=500, detail=f"Failed to get training jobs: {str(e)}")
@router.get("/tenants/{tenant_id}/jobs/{job_id}", response_model=TrainingJobResponse) @router.get("/tenants/{tenant_id}/training/jobs/{job_id}", response_model=TrainingJobResponse)
async def get_training_job( async def get_training_job(
job_id: str, job_id: str,
tenant_id: UUID = Path(..., description="Tenant ID"), tenant_id: UUID = Path(..., description="Tenant ID"),
@@ -179,7 +179,7 @@ async def get_training_job(
job_id=job_id) job_id=job_id)
raise HTTPException(status_code=500, detail=f"Failed to get training job: {str(e)}") raise HTTPException(status_code=500, detail=f"Failed to get training job: {str(e)}")
@router.get("/tenants/{tenant_id}/jobs/{job_id}/progress", response_model=TrainingJobProgress) @router.get("/tenants/{tenant_id}/training/jobs/{job_id}/progress", response_model=TrainingJobProgress)
async def get_training_progress( async def get_training_progress(
job_id: str, job_id: str,
tenant_id: UUID = Path(..., description="Tenant ID"), tenant_id: UUID = Path(..., description="Tenant ID"),
@@ -254,7 +254,7 @@ async def cancel_training_job(
job_id=job_id) job_id=job_id)
raise HTTPException(status_code=500, detail=f"Failed to cancel training job: {str(e)}") raise HTTPException(status_code=500, detail=f"Failed to cancel training job: {str(e)}")
@router.post("/tenants/{tenant_id}/products/{product_name}", response_model=TrainingJobResponse) @router.post("/tenants/{tenant_id}/training/products/{product_name}", response_model=TrainingJobResponse)
async def train_single_product( async def train_single_product(
product_name: str, product_name: str,
request: SingleProductTrainingRequest, request: SingleProductTrainingRequest,
@@ -309,7 +309,7 @@ async def train_single_product(
tenant_id=tenant_id) tenant_id=tenant_id)
raise HTTPException(status_code=500, detail=f"Failed to train product: {str(e)}") raise HTTPException(status_code=500, detail=f"Failed to train product: {str(e)}")
@router.post("/tenants/{tenant_id}/validate", response_model=DataValidationResponse) @router.post("/tenants/{tenant_id}/training/validate", response_model=DataValidationResponse)
async def validate_training_data( async def validate_training_data(
request: DataValidationRequest, request: DataValidationRequest,
tenant_id: UUID = Path(..., description="Tenant ID"), tenant_id: UUID = Path(..., description="Tenant ID"),