|
|
@@ -1,4 +1,4 @@ |
|
|
|
from fastapi import Depends, APIRouter, HTTPException, status |
|
|
|
from fastapi import Depends, APIRouter, File, Form, HTTPException, UploadFile, status |
|
|
|
from sqlalchemy.orm import Session |
|
|
|
from db.session import get_db |
|
|
|
from db.repository.maintenancejob import ( |
|
|
@@ -10,7 +10,7 @@ from db.repository.maintenancejob import ( |
|
|
|
) |
|
|
|
from typing import List |
|
|
|
from schemas.maintenancejob import CreateMaintenanceJob, OutputMaintenanceJob |
|
|
|
from schemas.carpart import CreateCarPart |
|
|
|
from schemas.carpart import CreateCarPart, ShowCarPart |
|
|
|
from db.models.user import User |
|
|
|
from apis.v1.route_auth import get_current_user |
|
|
|
|
|
|
@@ -34,9 +34,9 @@ def create_maintenancejob( |
|
|
|
return maintenancejob_res |
|
|
|
|
|
|
|
|
|
|
|
@router.post("/carpart", status_code=status.HTTP_201_CREATED) |
|
|
|
@router.post("/carpart", response_model = ShowCarPart ,status_code=status.HTTP_201_CREATED) |
|
|
|
def create_carpart( |
|
|
|
car_part: CreateCarPart, |
|
|
|
car_part: CreateCarPart = Depends(), |
|
|
|
db: Session = Depends(get_db), |
|
|
|
current_user: User = Depends(get_current_user), |
|
|
|
): |
|
|
@@ -44,8 +44,9 @@ def create_carpart( |
|
|
|
raise HTTPException( |
|
|
|
status_code=403, detail="You are not authorized to perform this action" |
|
|
|
) |
|
|
|
|
|
|
|
print("So it begins...") |
|
|
|
car_part_res = create_car_part(car_part=car_part, db=db) |
|
|
|
print("So it ends...") |
|
|
|
return car_part_res |
|
|
|
|
|
|
|
|
|
|
|