def create_user( payload: schemas.UserCreate, db: Session = Depends(get_db) ) -> models.UserModel: obj = models.UserModel(**payload.dict()) db.add(obj) db.commit() db.refresh(obj) return obj
def delete_from_db(self) -> None: Session.delete(self) Session.commit()
def save_to_db(self) -> None: Session.add(self) Session.commit()