inventorymgr/qualifications.py
def create_qualification() -> Dict[str, Any]:
    """API endpoint that creates a new qualification."""
    qualification_obj = api.NewQualification.parse_obj(request.json)

    if hasattr(qualification_obj, "id"):
        raise APIError(reason="id_specified", status_code=400)

    qualification = Qualification(**qualification_obj.dict())

    try:
        db.session.add(qualification)
        db.session.commit()
    except IntegrityError as exc:
        db.session.rollback()
        raise APIError(reason="object_exists", status_code=400) from exc

    return api.Qualification.from_orm(qualification).dict()
API endpoint that creates a new qualification.
API endpoint that creates a new qualification.
API endpoint that creates a new qualification .
def create_qualification() -> Dict[str, Any]:
    qualification_obj = api.NewQualification.parse_obj(request.json)
    if hasattr(qualification_obj, "id"):
        raise APIError(reason="id_specified", status_code=400)
    qualification = Qualification(**qualification_obj.dict())
    try:
        db.session.add(qualification)
        db.session.commit()
    except IntegrityError as exc:
        db.session.rollback()
        raise APIError(reason="object_exists", status_code=400) from exc
    return api.Qualification.from_orm(qualification).dict()
def create_qualification ( ) -> Dict [ str , Any ] : qualification_obj = api . NewQualification . parse_obj ( request . json ) if hasattr ( qualification_obj , "id" ) : raise APIError ( reason = "id_specified" , status_code = 400 ) qualification = Qualification ( ** qualification_obj . dict ( ) ) try : db . session . add ( qualification ) db . session . commit ( ) except IntegrityError as exc : db . session . rollback ( ) raise APIError ( reason = "object_exists" , status_code = 400 ) from exc return api . Qualification . from_orm ( qualification ) . dict ( )
API endpoint that creates a new qualification.
API endpoint that creates a new qualification .
"""API endpoint that creates a new qualification."""