diff --git a/app/apis/v1/route_maintenancejob.py b/app/apis/v1/route_maintenancejob.py index ed64d30..f3e10f1 100644 --- a/app/apis/v1/route_maintenancejob.py +++ b/app/apis/v1/route_maintenancejob.py @@ -9,7 +9,11 @@ from db.repository.maintenancejob import ( change_maintenance_status, ) from typing import List -from schemas.maintenancejob import CreateMaintenanceJob, OutputMaintenanceJob +from schemas.maintenancejob import ( + CreateMaintenanceJob, + OutputMaintenanceJob, + OutputMinimalMaintenanceJob, +) from schemas.carpart import CreateCarPart, ShowCarPart from db.models.user import User from apis.v1.route_auth import get_current_user @@ -28,13 +32,9 @@ def create_maintenancejob( status_code=403, detail="You are not authorized to perform this action" ) - maintenancejob_res = create_new_maintenancejob( - maintenancejob=maintenancejob, db=db - ) + maintenancejob_res = create_new_maintenancejob(maintenancejob=maintenancejob, db=db) if maintenancejob_res == "nodriver": - raise HTTPException( - status_code=404, detail="This car has no driver" - ) + raise HTTPException(status_code=404, detail="This car has no driver") return maintenancejob_res @@ -57,7 +57,9 @@ def create_carpart( @router.get( - "/", response_model=List[OutputMaintenanceJob], status_code=status.HTTP_200_OK + "/", + response_model=List[OutputMinimalMaintenanceJob], + status_code=status.HTTP_200_OK, ) def get_all_maintenancejobs( db: Session = Depends(get_db), diff --git a/app/schemas/maintenancejob.py b/app/schemas/maintenancejob.py index de117f0..79bd198 100644 --- a/app/schemas/maintenancejob.py +++ b/app/schemas/maintenancejob.py @@ -20,4 +20,14 @@ class OutputMaintenanceJob(BaseModel): TotalCost: float Vehicle: OutputVehicle FinishedBy: Optional[ShowUser] - Status: str + Status: str + + +class OutputMinimalMaintenanceJob(BaseModel): + Id: int + Description: str + Date: datetime + TotalCost: float + Vehicle: OutputVehicle + FinishedBy: Optional[ShowUser] + Status: str