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 save_to_db(self) -> None: Session.add(self) Session.commit()