示例#1
0
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'])
示例#2
0
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)
示例#3
0
def signup():
    return create_user(**request.json)
示例#4
0
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'])
示例#5
0
def register():
    return create_user(**request.json)
示例#6
0
def user_index_create(): 
    if request.method == 'GET':
        return get_all_users()
    if request.method == 'POST': 
        return create_user(**request.form)