|
@@ -9,7 +9,11 @@ from db.repository.maintenancejob import ( |
|
|
change_maintenance_status, |
|
|
change_maintenance_status, |
|
|
) |
|
|
) |
|
|
from typing import List |
|
|
from typing import List |
|
|
from schemas.maintenancejob import CreateMaintenanceJob, OutputMaintenanceJob |
|
|
|
|
|
|
|
|
from schemas.maintenancejob import ( |
|
|
|
|
|
CreateMaintenanceJob, |
|
|
|
|
|
OutputMaintenanceJob, |
|
|
|
|
|
OutputMinimalMaintenanceJob, |
|
|
|
|
|
) |
|
|
from schemas.carpart import CreateCarPart, ShowCarPart |
|
|
from schemas.carpart import CreateCarPart, ShowCarPart |
|
|
from db.models.user import User |
|
|
from db.models.user import User |
|
|
from apis.v1.route_auth import get_current_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" |
|
|
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": |
|
|
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 |
|
|
return maintenancejob_res |
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -57,7 +57,9 @@ def create_carpart( |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@router.get( |
|
|
@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( |
|
|
def get_all_maintenancejobs( |
|
|
db: Session = Depends(get_db), |
|
|
db: Session = Depends(get_db), |
|
|