def user_index_and_create(): if request.method == 'GET': return get_all_users() if request.method == 'POST': return create_user(name=request.form['name'], email=request.form['email'], nickname=request.form['nickname'])
def create_user(user: user_schema.UserCreate, db: Session = Depends(deps.get_db)): """ Create new user. """ db_user = user_crud.get_by_email(db, email=user.email) if db_user: raise HTTPException(status_code=400, detail="Email already registered") return user_crud.create_user(db=db, user=user)
def signup(): return create_user(**request.json)
def user_index_create(): if request.method == 'GET': return get_all_users() if request.method == 'POST': return create_user(request.form['name'], request.form['email'], request.form['bio'])
def register(): return create_user(**request.json)
def user_index_create(): if request.method == 'GET': return get_all_users() if request.method == 'POST': return create_user(**request.form)