コード例 #1
0
ファイル: crud.py プロジェクト: Maxanox/FastAPI_Pillbox
def doctors_delete_by_id(id: int, db: session):
    db_doctor = db.query(models.Doctor).filter(models.Doctor.id == id).first()

    if not db_doctor:
        raise HTTPException(status_code=status.HTTP_404_NOT_FOUND,
                            detail=f"doctor with the id '{id}' not found")

    db.delete(db_doctor)
    db.commit()
コード例 #2
0
ファイル: crud.py プロジェクト: Maxanox/FastAPI_Pillbox
def pillboxes_delete_by_id(id: int, db: session) -> None:
    db_pillbox = db.query(
        models.Pillbox).filter(models.Pillbox.id == id).first()

    if not db_pillbox:
        raise HTTPException(status_code=status.HTTP_404_NOT_FOUND,
                            detail=f"pillbox with the id '{id}' not found")

    db.delete(db_pillbox)
    db.commit()
コード例 #3
0
ファイル: crud.py プロジェクト: Maxanox/FastAPI_Pillbox
def patients_delete_by_id(id: int, db: session) -> None:
    db_patient = db.query(
        models.Patient).filter(models.Patient.id == id).first()

    if not db_patient:
        raise HTTPException(status_code=status.HTTP_404_NOT_FOUND,
                            detail=f"patient with the id '{id}' not found")

    db.delete(db_patient)
    db.commit()