inventorymgr/qualifications.py
def update_qualification(qual_id: int) -> Dict[str, Any]:
    """API endpoint that updates an existing qualification."""
    qualification_obj = api.Qualification.parse_obj(request.json)
    if qualification_obj.id != qual_id:
        raise APIError(reason="incorrect_id", status_code=400)

    if Qualification.query.filter_by(id=qual_id).count() < 1:
        raise APIError(reason="no_such_object", status_code=400)

    qualification = Qualification.query.get(qual_id)

    try:
        qualification.name = qualification_obj.name
        db.session.commit()
    except IntegrityError as exc:
        raise APIError(reason="qualification_exists", status_code=400) from exc

    return api.Qualification.from_orm(qualification).dict()
API endpoint that updates an existing qualification.
API endpoint that updates an existing qualification.
API endpoint that updates an existing qualification .
def update_qualification(qual_id: int) -> Dict[str, Any]:
    qualification_obj = api.Qualification.parse_obj(request.json)
    if qualification_obj.id != qual_id:
        raise APIError(reason="incorrect_id", status_code=400)
    if Qualification.query.filter_by(id=qual_id).count() < 1:
        raise APIError(reason="no_such_object", status_code=400)
    qualification = Qualification.query.get(qual_id)
    try:
        qualification.name = qualification_obj.name
        db.session.commit()
    except IntegrityError as exc:
        raise APIError(reason="qualification_exists", status_code=400) from exc
    return api.Qualification.from_orm(qualification).dict()
def update_qualification ( qual_id : int ) -> Dict [ str , Any ] : qualification_obj = api . Qualification . parse_obj ( request . json ) if qualification_obj . id != qual_id : raise APIError ( reason = "incorrect_id" , status_code = 400 ) if Qualification . query . filter_by ( id = qual_id ) . count ( ) < 1 : raise APIError ( reason = "no_such_object" , status_code = 400 ) qualification = Qualification . query . get ( qual_id ) try : qualification . name = qualification_obj . name db . session . commit ( ) except IntegrityError as exc : raise APIError ( reason = "qualification_exists" , status_code = 400 ) from exc return api . Qualification . from_orm ( qualification ) . dict ( )
API endpoint that updates an existing qualification.
API endpoint that updates an existing qualification .
"""API endpoint that updates an existing qualification."""
qual_id
int